情况:点击导航切换下方组件的内容展示,组件不变,变的只有路由后面的参数
<router-link :to="{ name: 'Itemlist', params: { category_id: item.product_category_id, category_name: item.product_category_name }, }">{{item.product_category_name}}</router-link>
如上图,路由只前往ItemList;
这样的问题是路径会切换,但是组件的内容并不刷新,查阅官方文档,
然后使用beforeRouteUpdate解决问题
beforeRouteUpdate(to, from, next) { next() //路由后的操作 },