【vue2.0】Cannot read property 'matched' of undefined
来源:互联网 发布:just do it 乔丹 编辑:程序博客网 时间:2024/06/12 22:00
最近在尝试用vue-cli 架手架自动生成vue2.0项目时,用到了vue-router。但是一直报错如下:
Uncaught TypeError: Cannot read property 'matched' of undefined
一直没找到原因,最终在尝试无数次后,发现问题在引入路由文件后的命名上,代码如下:
import Vue from 'vue'import App from './App'import VueRouter from 'vue-router'import Router from './router/index.js'Vue.use(VueRouter)/* eslint-disable no-new */new Vue({ el: '#app', Router, template: '<App/>', components: { App }})
在 import 路由文件后,我将它命名为Router
,就会出现报错,最终发现原因是:
router
才是Vue实例化的配置字段名称,写个其他的它当然不认识了。真是低级错误。
给自己一个红牌警告!
0 0
- 【vue2.0】Cannot read property 'matched' of undefined
- Vue2-Cannot read property 'component' of undefined
- vuejs路由使用的问题Error in render function: "TypeError: Cannot read property 'matched' of undefined"
- Vue2.0 之 vue Cannot read property '__ob__' of undefined 异常(back报错)
- Vue2.0 axios报错: Cannot read property 'protocol' of undefined
- "TypeError: Cannot read property 'undefined' of undefined"
- 关于TypeError: Cannot read property '0' of undefined
- vuejs2.0 提示Cannot read property 'push' of undefined
- Cannot read property 'autoCreated' of undefined
- TypeError: Cannot read property 'parentNode' of undefined
- Cannot read property 'nodeType' of undefined
- Cannot read property 'xxx' of undefined
- TypeError: Cannot read property 'left' of undefined
- [Jquery]Cannot read property 'msie' of undefined
- Cannot read property ‘msie’ of undefined
- Cannot read property ‘msie’ of undefined
- Cannot read property 'rownumbers' of undefined
- TypeError: Cannot read property 'newLine' of undefined
- echarts图形的弹窗修改方法
- Servlet
- C++之继承篇
- leetcode124~Binary Tree Maximum Path Sum Add to List
- JavaSript模块化
- 【vue2.0】Cannot read property 'matched' of undefined
- Ubuntu下批量更改图片大小
- Git使用错误收集:-ssh agent失败 错误代码-1
- java文件操作之递归获取视频文件
- 深入理解 CSS 时序函数
- 数据库版本控制插件Flyway Q&A
- 20170228找女朋友之路思考总结
- numpy数组拼接方法介绍
- 数据挖掘笔记(一)