vue项目警告:Emitted value instead of an instance of Error
一、问题描述
错误描述:翻译过来大概的意思就是缺少一个key,来指定相应的属性
warning in ./src/view/Index.vue
(Emitted value instead of an instance of Error) <el-menu-item v-for="item2 in item.children">: component lists rendered with v-for should have explicit k
eys. See https://vuejs.org/guide/list.html#key for more info.@ ./src/view/Index.vue 11:0-361@ ./src/router/index.js@ ./src/main.js@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.jswarning in ./src/view/Index.vue(Emitted value instead of an instance of Error) <el-submenu v-for="item in $router.options.routes">: component lists rendered with v-for should have expl
icit keys. See https://vuejs.org/guide/list.html#key for more info.@ ./src/view/Index.vue 11:0-361@ ./src/router/index.js@ ./src/main.js@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.jswarning in ./src/view/Index.vue(Emitted value instead of an instance of Error) <el-menu-item v-for="item2 in item.children">: component lists rendered with v-for should have explicit k
eys. See https://vuejs.org/guide/list.html#key for more info.@ ./src/view/Index.vue 11:0-361@ ./src/router/index.js@ ./src/main.js@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.jswarning in ./src/view/Index.vue(Emitted value instead of an instance of Error) <el-menu-item v-for="item2 in item.children">: component lists rendered with v-for should have explicit k
eys. See https://vuejs.org/guide/list.html#key for more info.@ ./src/view/Index.vue 11:0-361@ ./src/router/index.js@ ./src/main.js@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.jswarning in ./src/view/Index.vue
(Emitted value instead of an instance of Error) <el-submenu v-for="item in $router.options.routes">: component lists rendered with v-for should have expl
icit keys. See https://vuejs.org/guide/list.html#key for more info.@ ./src/view/Index.vue 11:0-361@ ./src/router/index.js@ ./src/main.js@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
出现警告的代码:
<el-submenu v-for="(item,index) in $router.options.routes" :key="index" :index="index+''"><template slot="title"><i class="el-icon-message"></i>{{item.name}}</template><el-menu-item v-for="(item2,index2) in item.children" :index="item2.path":class="$route.path==item2.path?'is-active':''">{{item2.name}}</el-menu-item>
</el-submenu>
二、解决方案
增加语句 :key = “index”,具体位置可参照下面的代码
<el-submenu v-for="(item,index) in $router.options.routes" :key="index" :index="index+''"><template slot="title"><i class="el-icon-message"></i>{{item.name}}</template><el-menu-item v-for="(item2,index2) in item.children" :key="index2" :index="item2.path":class="$route.path==item2.path?'is-active':''">{{item2.name}}</el-menu-item>
</el-submenu>
处理之后,再运行项目,警告就没有了。。。
vue项目警告:Emitted value instead of an instance of Error相关推荐
- Vue 项目提示:`(Emitted value instead of an instance of Error) the “scope“ attribute for scoped slots
Vue 完整警告信息: `(Emitted value instead of an instance of Error) the "scope" attribute for sco ...
- Vue解决warning Emitted value instead of an instance of Error
避免Emitted value instead of an instance of Error, 这部分在运行的时候就会出现问题 <el-submenu v-for="(item,in ...
- Vue启动项目出现警告Emitted value instead of an instance of Error the scope attribute for scoped slots have
启动Vue项目时可以正常启动,但是报出一个警告. 解决方法:根据警告的信息按照路径,找到出现警告的文件Table.vue,依据下面的信息,将scope属性替换成slot-scope,scop ...
- VUE解决warning(Emitted value instead of an instance of Error) el-table-column v-for=item in batch问题
报警告之前 <el-table-column :label="item" v-for="(item,index) in batchs" > ...
- 前端开发:Vue项目中解决Emitted value instead of an instance of Error问题
分享一个在刚接触前端开发的开发者常遇到的一个经典错误,那就是在Vue项目运行中遇到Emitted value instead of an instance of Error的问题,附带解决该问题的方法 ...
- vue启动报错 Emitted value instead of an instance of Error
vue项目install正常,npm run dev启动时因为警告导致项目不能启动. 异常提示: (Emitted value instead of an instance of Error)< ...
- (Emitted value instead of an instance of Error)
本地运行vue项目因为警告导致 不能启动 (Emitted value instead of an instance of Error) Do not use v-for index as key o ...
- (Emitted value instead of an instance of Error) postcss-viewport-units:
报错信息: (Emitted value instead of an instance of Error) postcss-viewport-units: '.mint-switch-core::af ...
- Emitted value instead of an instance of Error) <v-uni-view v-for=“item in pi
问题一 Emitted value instead of an instance of Error) <v-uni-view v-for="item in pi A:这个报错主要是v- ...
最新文章
- PCIPCIE MSI中断
- Struts文件上传与下载详解_文件的下载
- 基于webpack的react脚手架
- 开发部考核管理制度 随想
- 正则表达式与python re
- 紧追SpaceX,又一星际飞船明年4月要首次载人飞行
- html微软雅黑字体模糊,如何解决WinXP下微软雅黑字体不清晰的问题
- Java关键字this与super的用法详解
- 随手一写,简单的四则运算练习
- myeclipse 隐藏父级包
- 残缺、时间一起的爱情
- 名词解释失效安全_安全管理名词解释
- FFmpeg如何设置编码器私有参数
- 基础知识 字节、KB、MB、GB 之间的换算关系
- IOS关闭锁屏状态下左滑相机
- 报错:TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the
- 自动记录电脑开关机时间
- 前端js,将英文字符转换大小写
- 怎么设置linux系统定时关机,Linux系统定时关机
- 微信小程序模拟车位选择功能(简陋版本)