antd vue 刷新保留当前页面路由,保留选中菜单,保留menu选中
废话不说,上代码!<a-menu theme="dark" mode="inline" :selectedKeys="[$route.path]"><a-menu-item :key="'/home'"><router-link to="home"><a-icon type...
·
废话不说,上代码!
<a-menu theme="dark" mode="inline" :selectedKeys="[$route.path]">
<a-menu-item :key="'/home'">
<router-link to="home">
<a-icon type="user" />
<span>nav 1</span>
</router-link>
</a-menu-item>
<a-menu-item :key="'/about'">
<router-link to="about">
<a-icon type="video-camera" />
<span>nav 2</span>
</router-link>
</a-menu-item>
<a-menu-item :key="'/123123'">
<router-link to="123123">
<a-icon type="upload" />
<span>nav 3</span>
</router-link>
</a-menu-item>
</a-menu>
重点:
1,selectedkeys要设置成$route.path地址
2,a-menu-item 的key设置成要去的地址
刷新页面,成功!
更多推荐
已为社区贡献23条内容
所有评论(0)