微信小程序踩坑- tabBar.list[3].selectedIconPath 大小超过 40kb
重新启动微信小程序编辑器的时候遇到了这样的一个问题:
tabBar.list[3].selectedIconPath 大小超过 40kb
![](https://upload-images.jianshu.io/upload_images/5640239-f9c8f187d1f122a9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
微信小程序开发的过程之中总会出现这样或者那样的错误,需要我们耐心的去寻找,仔细查看和百度查询之后,发现了原因:其中有一张图片,替换的时候没有注意图片大小,导致项目无法预览。
![](https://upload-images.jianshu.io/upload_images/5640239-da2c79c42ed186bb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/455)
参考了一下微信小程序的官方API,查看tabBar list定义说明:也就是说选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,而我新加入的头像尺寸过大。
![](https://upload-images.jianshu.io/upload_images/5640239-1c0a6d1d94f5a134.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
当改变了图片的大小之后,报错消失,顺利解决bug,继续下一步的项目进程。
![](https://upload-images.jianshu.io/upload_images/5640239-f5102e3003e782f1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/567)
关注「编程微刊」公众号 ,在微信后台回复「领取资源」,获取IT资源300G干货大全。公众号回复“1”,拉你进程序员技术讨论群.
![](https://img-blog.csdn.net/20180629104320721?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM2NTM4MDEy/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)