Element: el-menu导航动态绑定,会报错

Created on 10 Dec 2016  ·  3Comments  ·  Source: ElemeFE/element

hi,很高兴使用上你们提供的UI组件,真的很棒!但是我在使用el-menu的时候发现,如果用v-for循环遍历生成el-menu的时候绑定index,控制台会报错。是我使用的方法有问题么?代码如下:
https://jsfiddle.net/LittleChild/kajf2cx2/

question

Most helpful comment

el-submenu 要求 index 参数为字符串类型,而 :index="index" 这样绑定的是数字类型。改成 :index="index + ''" 就可以。

All 3 comments

el-submenu 要求 index 参数为字符串类型,而 :index="index" 这样绑定的是数字类型。改成 :index="index + ''" 就可以。

谢谢👍

我遇到类似的问题:{{secItem.name}} 对这个二级导航条,componet都是string,一直报错vue.esm.js?65d7:576 [Vue warn]: Duplicate keys detected: 'index'. This may cause an update error.,求大神帮忙看看

Was this page helpful?
0 / 5 - 0 ratings