now there are three components, A component, B component and C component
when I jump from A component to B component, B component writes
beforeCreate(){
let status=this.$route.query.status;
switch (status){
case 1: document.title=""
break;
case 2: document.title=""
break;
case 3: document.title="";
break;
default:
console.log(status == 1);
document.title="";
break;
}
},
the name of the browser changes, but when I jump from component B to component C, when I jump from component C to component B, the name of the browser changes to-- (because the name of the title of component B is dynamic, I change the initial value to -)
so now the switch equal to 1 is not executed, and what I print in default also returns true
why not execute it?
I can just change to the if statement, but why not execute the case equals 1 in switch?
beforeCreate(){
//title
let status=this.$route.query.status;
if(status == 1){
document.title=""
}else if(status == 2){
document.title=""
}else if(status == 3){
document.title=""
}
},
I am curious about what causes this problem.