这是我的router.js
export default new VueRouter({
mode: 'history',
routes: [
{path: '/:mid', component: load('views/main'), meta: {name: 'Main'}},
{path: '/:mid/auth/:uid', component: load('views/auth'), meta: {name: 'Login'}},
{path: '/:mid/success', component: load('views/success'), meta: {name: 'LoginSuccess'}},
....
]
})
这是main.js
Quasar.start(() => {
new Vue({
el: '#q-app',
created() {
console.log(this.$route.params)
},
router,
store,
render: h => h(require('./App'))
})
})
当我访问localhost:8080 / abc / auth / 123时,控制台显示{}而不是{mid:'abc',uid:123}。
有什么想法吗?
======更新==
console.log(this)显示了这个:
Vue$2 {_uid: 3, _isVue: true, $options: {…}, _renderProxy: Proxy, _self: Vue$2, …}
$children:[VueComponent]
$createElement:ƒ (a, b, c, d)
$el:div#q-app
...(too many lines)
console.log(此。$ route)显示:
{name: null, meta: {…}, path: "/", hash: "", query: {…}, …}
fullPath:"/"
hash:""
matched:[]
meta:{}
name:null
params:{}
path:"/"
query:{}
__proto__:Object