v-modle表示当前选中标签的名称或索引值,默认类型为number | string,默认值为0,通常标签中的v-modle = “active”,active需要在JS中的响应式数据中定义。
解决刷新后,高亮按钮显示与当前页面内容不匹配如下:
mounted(){
// 解决刷新后,tabbar高亮按钮始终显示在第一个上
// window.location.pathname获取地址栏中的路径
switch( window.location.pathname){
case '/Home/Index' : this.active = 0;break;
case '/Active' : this.active = 1;break;
case '/PayForm' : this.active = 2;break;
case '/Mine' : this.active = 3;break;
default : this.active = 0;
}
}