做电商网站时会经常遇到这种三级标签,如果使用router-link跳转那会给每个标签都加上,非常耗性能,所以一般都是使用编程式导航和事件委托来完成路由跳转,我们可以给每个a标签打上自定义属性data-XXX,然后一级菜单和二级菜单还有三级菜单各打上鸽子的自定义属性data-xxx123
<div class="all-sort-list2" @click="goSearch" @mouseleave="leaveIndex">
<div class="item" v-for="(c1,index) in categoryList" v-show="index!==16" :key="c1.categoryId" :class="{cur:currentIndex===index}">
<h3 @mouseenter="changeIndex(index)" >
<a :data-categoryName="c1.categoryName" :data-category1Id="c1.categoryId" >{
{c1.categoryName}}</a>
</h3>
<div class="item-list clearfix" :style="{display:currentIndex=&