vue 报异常
:8080/#/:2961 Uncaught TypeError: Cannot read property 'matched' of undefined
原因:
vue构造器需要严格按照标准;
比如 路由民称为 router
import router from './routes.js' const app = new Vue({ el: '#app', router, render: h => h(App) }) 以上是正确的; 下边是错误的: import rou from './routes.js' const app = new Vue({ el: '#app', rou, render: h => h(App) })
路由名称必须为:router
如果想自定义:
import routes from './routes.js' const app = new Vue({ el: '#app', router: routes, render: h => h(App) })