我試圖讓路由定義外部鏈接與查詢字串的路徑通過beforeEnter()如下:
Vue.use(VueRouter)
const routes = [
{
path: '/',
beforeEnter() {location.href = '/path=' this.$router.query.path},
name: 'Home',
component: Home3
},
但是我有一個錯誤“無法讀取未定義的屬性(讀取 $route)”。

我應該如何使用查詢將正確的定義寫入外部鏈接?
uj5u.com熱心網友回復:
有3個PARAMS中beforeEnter
你的代碼應該是這樣的:
beforeEnter(to, from, next) {
location.href = '/path=' to.query.path
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/359616.html
