vue+element 点击页面内跳转按钮 导航菜单选中
<template> <el-menu router theme="dark" :default-active="activeIndex" class="el-menu-demo" active-text-color="rgb(250,83,83)" mode="horizontal" @select="handleSelect" > <el-menu-item index="/">首页</el-menu-item> <el-menu-item index="/Material" >我要找</el-menu-item> <el-menu-item index="/Workbench" >工作台</el-menu-item> </el-menu> </template> <script> export default { data() { return { activeIndex: this.$route.path }; }, watch:{ '$route'(to,from){ this.activeIndex=to.path } }, mounted(){ }, methods: { handleSelect(key, keyPath) { } } }; </script>
本文作者:___mouM
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。
版权说明:本文版权归作者和博客园共有,欢迎转载。但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利.