做网站工作室名字,上海哪家公司提供专业的网站建设,宿州网站开发建设,企业所得税优惠政策2021年首先看官方文档的示例#xff1a;
需要注意的是#xff1a;
1、default-active的值是字符串#xff0c;那么index绑定的值也要是字符串#xff0c;且数字对应。不能default-avtive绑定的是1#xff0c;而menu-item的index绑定的是45
2、default-active的值是当前选中me…首先看官方文档的示例
需要注意的是
1、default-active的值是字符串那么index绑定的值也要是字符串且数字对应。不能default-avtive绑定的是1而menu-item的index绑定的是45
2、default-active的值是当前选中menu-item项的index
所以el-menu-item的index项一定要和default-active对应起来。 el-menu:default-activeactiveIndexclassel-menu-demomodehorizontalselecthandleSelectel-menu-item index1Processing Center/el-menu-itemel-sub-menu index2template #titleWorkspace/templateel-menu-item index2-1item one/el-menu-itemel-menu-item index2-2item two/el-menu-itemel-menu-item index2-3item three/el-menu-itemel-sub-menu index2-4template #titleitem four/templateel-menu-item index2-4-1item one/el-menu-itemel-menu-item index2-4-2item two/el-menu-itemel-menu-item index2-4-3item three/el-menu-item/el-sub-menu/el-sub-menuel-menu-item index3 disabledInfo/el-menu-itemel-menu-item index4Orders/el-menu-item/el-menu
script langts setup
import { ref } from vue
const activeIndex ref(1)
const handleTest (key,keyPath) {console.log(打印输出menuSelect事件的参数---,activeIndex.value,key,keyPath)
}
/script 再次点击其他项 为了避免页面刷新时menu组件的选中样式消失所以在每次点击的时候我们要将default-active重新赋值。这样default-active绑定的就是动态的了。