2 11.菜单选中和路由关联

  • 设置菜单默认选中

FMain.vue

<el-menu unique-opened 
  :collapse-transition="false"    
  :collapse="isCollapse" 
  :default-active="defaultActive" 
  class="border-0" 
@select="handleSelect">





import { useRouter,useRoute } from "vue-router"

const route = useRoute()


// 默认选中
const defaultActive = ref(route.path)

Last updated