watch函數中監聽$route
watch: {
$route(to, from) {
// console.log("to");
// console.log(to);
// console.log("from");
// console.log(from);
// console.log("this.$route.path");
// console.log(this.$route.path);
this.defaultActive = to.path;
}
}
參數解釋
to表示將當前所在路由信息, from表示從哪跳轉到路由信息