鍍金池/ 問答/HTML/ vue單頁(yè)面F5刷新,如何獲得當(dāng)前路由地址

vue單頁(yè)面F5刷新,如何獲得當(dāng)前路由地址

console.log(this.$router.path)拿不到,undefined

回答
編輯回答
憶往昔

window.location.href

2018年3月9日 23:50
編輯回答
雨萌萌

window.location.pathname 了解一下

2017年5月15日 13:10
編輯回答
清夢(mèng)

this.$route.path,不是this.$router.path;
使用vue-router相關(guān)方法是router,獲取相關(guān)路由是route;

2017年3月7日 20:57
編輯回答
晚風(fēng)眠

給你配置的路由都加個(gè)name屬性
獲取name吧

2018年7月19日 01:37