您当前的位置: 首页 > 

Vuejs 使用官网上面的例子

Dongguo丶 发布时间:2018-11-07 10:48:34 ,浏览量:4

vue.js报错 vue.js:597 [Vue warn]: Cannot find element: #app

问题: vue.js:597 [Vue warn]: Cannot find element: #app-4 检查了几遍代码没错,最后发现是引入vue的script必须放在body的末尾行。解决: 引入vue的script必须放在body的末尾行。

------------------------------------------------------------------------------

1.使用vuejs 官网上面的例子,在控制台中发现了错误了,

VM2369 vue.js:2658 [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.  (found in root instance)

此原因是需要先注册组件,然后新建Vue

,顺序不能颠倒

2.源码:


Vue.component('todo-item', {
  props: ['todo'],
  template: '
  • {{ todo.text }}
  • ' }) var app7 = new Vue({ el: '#app-7', data: { groceryList: [ { text: 'Vegetables' }, { text: 'Cheese' }, { text: 'Whatever else humans are supposed to eat' } ] } })
    关注
    打赏
    1688896170
    查看更多评论

    Dongguo丶

    暂无认证

    • 4浏览

      0关注

      459博文

      0收益

    • 0浏览

      0点赞

      0打赏

      0留言

    私信
    关注
    热门博文
    立即登录/注册

    微信扫码登录

    0.0472s