详细问题描述
在main.js中引入Vue.prototype文件后,在页面中v-for循环渲染中调用该文件中的某方法带参数时无法读取当前item,但是可以读取当前vue实例的data中数据
只有H5可以实现
其余端都会出现以上说明情况
如果直接将方法写在main.js中再进行调用,就不会出现这种情况
大佬们请直接下载图片查看
重现步骤
[步骤]
1.在common文件下创建一个js文件
2.在main.js中引入该js文件,将该js文件用Vue.prototype实现
3.在页面v-for循环里面实现该js文件中的某个方法并带上当前item数据
[结果]
[Vue warn]: Property or method "item" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property
IDE运行环境说明
使用HBuilderX
IDE版本号:2.0.1.20190614
windows版本号:windows10 企业版 LTSC 64位 (10.0, 版本 17763)
uni-app运行环境说明
除H5外所有端都有问题
项目是HBuilderX创建的
自定义组件模式
附件
联系方式
qq:971670888