uniapp开发微信小程序问题记录

917 阅读1分钟

问题1:main.ts引入uview-plus报错:无法找到模块uview-plus的声明文件。 解决方法:env.d.ts里添加declare module 'uview-plus';

问题2:小程序报错-ReferenceError: regeneratorRuntime is not defined 解决方法:微信开发者工具-详情-本地配置-关闭ES6转ES5

问题3:

faa50625002eb894b2a387e3813c104.png 报错:元素隐式具有 "any" 类型,因为类型为 "0" 的表达式不能用于索引类型 "Ref<tabArrType[] | undefined>"。 类型“Ref<tabArrType[] | undefined>”上不存在属性“0”。 解决方法:vue3使用ref定义值,取值时需要加.value

问题4:引用在浏览器中展示,在微信小程序中不展示 解决方法:pages.json里的tabBar中的custom改成false

1664362076271.png

问题5:不生效 解决方法:在pages.json里的tabBar中修改selectedColor

问题6:ts定义event参数

1665383041479.png