首页 新闻 会员 周边

vue前端无法显示后端数据

0
[待解决问题]

可能出问题的代码
<el-submenu v-for="(item,index) in $router.options.routes" :index="index+''
" v-if="item.show">
<template slot="title">{{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>
下面是两条错误提示
warning in ./src/App.vue?vue&type=template&id=7ba5bd90&

Module Warning (from ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js):
(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 explicit keys. See https://vuejs.org/guide/list.html#key fo
r more info.

warning in ./src/App.vue?vue&type=template&id=7ba5bd90&

Module Warning (from ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js):
(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 keys. See https://vuejs.org/guide/list.html#key for more
info.

messiqaz的主页 messiqaz | 初学一级 | 园豆:6
提问于:2022-04-08 14:07
< >
分享
所有回答(1)
2

列表渲染循环中加上:key="index"

DreamCatt | 园豆:239 (菜鸟二级) | 2022-04-08 16:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册