element icon indicating copy to clipboard operation
element copied to clipboard

使用el-submenu中的slot来渲染菜单出现slot重复警告

Open maxiaoguang64 opened this issue 9 years ago • 5 comments

What is Expected?

使用el-submenu中的slot来渲染菜单出现slot重复警告

代码 <el-menu class="el-menu-vertical-demo" unique-opened router :class="{'toggled': sidebarToggled}" :default-active="$route.path"> <template v-for="(menu, index) in menus"> <el-submenu :index="index + ''"> <template slot="title"><i class="el-submenu__icon fa fa-dashboard"></i><span class="el-submenu__name">{{menu.name}}</span></template> <el-menu-item v-for="child in menu.children" :index="child.path"><span class="el-menu-item__name">{{child.name}}</span></el-menu-item> </el-submenu> </template> </el-menu>

firebug控制台输出 [Vue warn]: Duplicate presence of slot "default" found in the same render tree - this will likely cause render errors. (found in ) http://localhost:8080/app.js line 724 > eval Line 565

[Vue warn]: Duplicate presence of slot "title" found in the same render tree - this will likely cause render errors. (found in ) http://localhost:8080/app.js line 724 > eval Line 565

maxiaoguang64 avatar Mar 09 '17 03:03 maxiaoguang64

给一下 demo

Leopoldthecoder avatar Mar 09 '17 03:03 Leopoldthecoder

@Leopoldthecoder
github地址https://github.com/ElemeFE/element-dashboard 登录之后进入首页(此时不报错) 刷新浏览器后会报错

maxiaoguang64 avatar Mar 09 '17 05:03 maxiaoguang64

我也碰到了,很奇怪是在一个特定的页面,刷新后才会出现。

susansjy avatar Mar 16 '17 09:03 susansjy

@susansjy 这个问题应该是使用了watch导致的 我的代码加入vuex之后去掉了watch自动解决了

如果说的不对,我觉得我们可以交流一下

maxiaoguang64 avatar Mar 17 '17 02:03 maxiaoguang64

Hello, this issue has been closed because it does not conform to our issue requirements. Please submit issues with issue-generator. More info can be found in #3693.

element-bot avatar Mar 24 '17 02:03 element-bot