美文网首页
VUE路由报错 Cannot read property '$

VUE路由报错 Cannot read property '$

作者: 刘小钢 | 来源:发表于2019-07-26 16:13 被阅读0次

VUE路由报错  Cannot read property '$createElement' of undefined

/*new Vue({

el: '#app',  // 用了路由后就先不用这种方式 用.$mount("#app")

components: { App },  //用了路由后这个也不用了

template: ''  //用了路由后为不让他直接进入App里面  我们给的是路由的地址 用的是es6的语法 我们可以直接使用标签而不用拼接

})*/

//设置路由

const router =new VueRouter({

mode:'history',

base:__dirname,

routes:[

{path:"/",components:User},// 执行到User.vue的页面

    {path:"/Test",components:Test}// 执行到Test.vue的页面

    ]

})

仔细观察后 发现我用的

{path:"/",components:User},// 执行到User.vue的页面

    {path:"/Test",components:Test}// 执行到Test.vue的页面

所以直接 去掉s就好了

{path:"/",component:User},// 执行到User.vue的页面

    {path:"/Test",component:Test}// 执行到Test.vue的页面

相关文章

网友评论

      本文标题:VUE路由报错 Cannot read property '$

      本文链接:https://www.haomeiwen.com/subject/vwddrctx.html