1.关于elementUI中出现的导航菜单的index报错:为:
<p color="red">Invalid prop: type check failed for prop "index". Expected String, got Number.</p>
原来的写法:
<el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose">
<el-submenu index="1">
<template slot="title">导航一</template>
<el-menu-item index="1-1">选项1</el-menu-item>
<el-menu-item index="1-2">选项2</el-menu-item>
</el-submenu>
</el-menu>
而当动态插入的时候,需要使用:index,且需要写为:
:index="String(index)"
index是为dom加的属性(是定值),而:index加的值相当于一个变量(可随时改变)