一、问题描述

错误描述:翻译过来大概的意思就是缺少一个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相关推荐

  1. 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 ...

  2. Vue解决warning Emitted value instead of an instance of Error

    避免Emitted value instead of an instance of Error, 这部分在运行的时候就会出现问题 <el-submenu v-for="(item,in ...

  3. Vue启动项目出现警告Emitted value instead of an instance of Error the scope attribute for scoped slots have

    启动Vue项目时可以正常启动,但是报出一个警告.      解决方法:根据警告的信息按照路径,找到出现警告的文件Table.vue,依据下面的信息,将scope属性替换成slot-scope,scop ...

  4. 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" >     ...

  5. 前端开发:Vue项目中解决Emitted value instead of an instance of Error问题

    分享一个在刚接触前端开发的开发者常遇到的一个经典错误,那就是在Vue项目运行中遇到Emitted value instead of an instance of Error的问题,附带解决该问题的方法 ...

  6. vue启动报错 Emitted value instead of an instance of Error

    vue项目install正常,npm run dev启动时因为警告导致项目不能启动. 异常提示: (Emitted value instead of an instance of Error)< ...

  7. (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 ...

  8. (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 ...

  9. 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- ...

最新文章

  1. PCIPCIE MSI中断
  2. Struts文件上传与下载详解_文件的下载
  3. 基于webpack的react脚手架
  4. 开发部考核管理制度 随想
  5. 正则表达式与python re
  6. 紧追SpaceX,又一星际飞船明年4月要首次载人飞行
  7. html微软雅黑字体模糊,如何解决WinXP下微软雅黑字体不清晰的问题
  8. Java关键字this与super的用法详解
  9. 随手一写,简单的四则运算练习
  10. myeclipse 隐藏父级包
  11. 残缺、时间一起的爱情
  12. 名词解释失效安全_安全管理名词解释
  13. FFmpeg如何设置编码器私有参数
  14. 基础知识 字节、KB、MB、GB 之间的换算关系
  15. IOS关闭锁屏状态下左滑相机
  16. 报错:TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the
  17. 自动记录电脑开关机时间
  18. 前端js,将英文字符转换大小写
  19. 怎么设置linux系统定时关机,Linux系统定时关机
  20. 微信小程序模拟车位选择功能(简陋版本)

热门文章

  1. 来自网络的一些经典语句小摘
  2. Oracle EBS 洽谈报价的操作流程测试
  3. 酒店vr全景展示拍摄提供更多合作和洽谈的机会
  4. auto与register
  5. lnmp一键安装包linux,linux centos7.3 lnmp一键安装包集成
  6. 重温-八零年代-那个我一路过来的年代
  7. 这些css 动画效果你一定要收藏
  8. 【程序人生】怎样养生?关于中医的核心思想,经典著作,与西医理念的对比,优缺点
  9. GRUB的使用(-)
  10. 软件工程专业大二操作系统实验报告