vue this.$route和 this.$router的區別

因爲都綁定在this上,我們可以把this 打印出來查看 this.$route是路由參數對象,所有路由中的參數,params,query 都屬於它。 this.$router是一個路由(導航對象),用它實現路由的前進,後退,跳轉到新的url地址 路由傳參的方式 1.this.$router.push({path:'/city/${cityid}'}), 這樣傳遞參數的話,配置路由時需在path上
相關文章
相關標籤/搜索