Open JensenYao opened 5 years ago
首页跳到分类页tabbar 没有跟随跳转需要加一个路由监听,你写在created 里的 switch 可以不用去写,进入首页created 只会执行一次。 添加监听代码如下: watch: { $route: { handler(val, oldVal) { switch (val.name) { case "home": this.active = 0; break; case "category": this.active = 1; break; case "eat": this.active = 2; break; case "cart": this.active = 3; break; case "mine": this.active = 4; break; default: break; } }, deep: true }
This Bug has Fixed on https://github.com/Geek-James/ddBuy/commit/f1d7e93e1991b27f042aa5af7144a582c6df3ec8
首页跳到分类页tabbar 没有跟随跳转需要加一个路由监听,你写在created 里的 switch 可以不用去写,进入首页created 只会执行一次。 添加监听代码如下: watch: { $route: { handler(val, oldVal) { switch (val.name) { case "home": this.active = 0; break; case "category": this.active = 1; break; case "eat": this.active = 2; break; case "cart": this.active = 3; break; case "mine": this.active = 4; break; default: break; } }, deep: true }