解决方法::index里面呢的 index的值不能有空格,并且要为字符串类型,然后在后面加上.toString()
<el-menu
:default-active="this.$route.path"
class="el-menu-demo menuNav scroll-menu"
mode="horizontal"
background-color="#FFFFFF"
style="border-top: none"
text-color="#444645"
active-text-color="#444645"
>
<div class="menuWidth">
<el-menu-item
class="updateRedFont"
:index="1 + index.toString()"
v-for="(item, index) in menuData"
:key="index"
@click="active = index"
>
{{ item.sysMenuName }}
</el-menu-item>
</div>
<el-submenu index="2">
<template slot="title">更多</template>
<el-menu-item
class="updateRedFont"
:index="1 + index.toString()"
v-for="(item, index) in menuData"
:key="index"
@click="active = index"
>
{{ item.sysMenuName }}
</el-menu-item>
</el-submenu>
</el-menu>