uni-app Emitted value instead of an instance of Error
uni-app Emitted value instead of an instance of Error
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | win10 | HBuilderX |
产品分类:uniapp/小程序/微信
PC开发环境操作系统:Windows
PC开发环境操作系统版本号:win10
HBuilderX类型:正式
HBuilderX版本号:3.1.10
第三方开发者工具版本号:3
基础库版本号:3
项目创建方式:HBuilderX
### 操作步骤:
16:23:41.934 WARNING: Module Warning (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js):
16:23:41.935 (Emitted value instead of an instance of Error) `<swiper-item v-for="subject in subjectList">`: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
16:23:41.949 DONE Build complete. Watching for changes...
### 预期结果:
出现在哪个页面
### 实际结果:
什么页面也没有提示
### bug描述:
16:23:41.934 WARNING: Module Warning (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js):
16:23:41.935 (Emitted value instead of an instance of Error) `<swiper-item v-for="subject in subjectList">`: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
16:23:41.949 DONE Build complete. Watching for changes...
能告诉我那个页面有问题吗
更多关于uni-app Emitted value instead of an instance of Error的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复
更多关于uni-app Emitted value instead of an instance of Error的实战教程也可以访问 https://www.itying.com/category-93-b0.html
这是一个Vue的常见警告,不是uni-app特有的错误。问题出现在使用了v-for循环渲染swiper-item组件的页面。
警告信息明确指出:<swiper-item v-for="subject in subjectList">这个循环渲染缺少必要的key属性。
解决方案:
在swiper-item上添加唯一的key属性:
<swiper-item v-for="subject in subjectList" :key="subject.id">

