Geek-James / ddBuy

🎉Vue全家桶+Vant 搭建大型单页面电商项目.http://ddbuy.7-orange.cn
MIT License
2.44k stars 554 forks source link

首页跳到分类页tabbar 没有跟随跳转需要加一个路由监听 #8

Open JensenYao opened 5 years ago

JensenYao commented 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 }

Geek-James commented 5 years ago

This Bug has Fixed on https://github.com/Geek-James/ddBuy/commit/f1d7e93e1991b27f042aa5af7144a582c6df3ec8