page is to switch pictures if a picture else a picture this is a component required to import this component
<footer>
<ul>
<li @click="tu_one(1)"><img src="../assets/home_ji.png" v-if="tab == "tab-1""/><img src="../assets/home_ji_fan.png" v-else/></li>
<li @click="tu_one(2)"><img src="../assets/home_shou.png" v-if="tab == "tab-2""/><img src="../assets/home_shou_fan.png" v-else/></li>
<li @click="tu_one(3)"><img src="../assets/home_user_fan.png" v-if="tab == "tab-3""/><img src="../assets/home_user.png" v-else/></li>
</ul>
</footer>
data(){
return{
tab:"tab-2"
}
},
tu_one(num){
let _num = parseInt(num,10);
switch (_num){
case 1:
this.$router.push("/Record");
break;
case 2:
this.$router.push("/home");
break;
case 3:
this.$router.push("/user");
break;
default:
break;
}
this.tab = `tab-${_num}`;
console.log(this.tab);//
}
}
The page jumps normally, but the picture hasn"t moved. Why? How to solve it?