vue点击菜单跳转时,背景颜色动态变化
**vue点击菜单跳转时,背景颜色动态变化**html:script:export default {name: “menu”,data() {return {activeKey: 0}},methods: {onclick(index) {this.KaTeX parse error: Expected '}', got 'EOF' at end of ...
**
vue点击菜单跳转时,背景颜色动态变化
**
html:
script:
export default {
name: “menu”,
data() {
return {
activeKey: 0
}
},
methods: {
onclick(index) {
this.KaTeX parse error: Expected '}', got 'EOF' at end of input: … this.router.push(’/menu1’)
}else if ( index == 1){
this.KaTeX parse error: Expected 'EOF', got '}' at position 31: …enu3') }̲else if ( index…router.push(’/menu3)
}else if ( index == 3){
this.KaTeX parse error: Expected 'EOF', got '}' at position 31: …enu4') }̲else if ( index…router.push(’/’)
}
},
}
}
css:
.Active{
background-color: rgba(9, 43, 89, 0.95);
color: #fff;
}
store:
const state = {
Active:0,
};
方法是实现了,但是还是有bug,刷新后背景颜色会回到默认的菜单栏,不会随路由改变,有好的解决办法的欢迎交流(参照同学教的点击跳转改变背景颜色)
更多推荐
所有评论(0)