Vue.js unknown custom element

前端 未结 9 2011
我在风中等你
我在风中等你 2020-12-02 11:01

I\'m a beginner with Vue.js and I\'m trying to create an app that caters my daily tasks and I ran into Vue Components. So below is what I\'ve tried but unfortunately, it giv

9条回答
  •  一向
    一向 (楼主)
    2020-12-02 11:22

    I was following along the Vue documentation at https://vuejs.org/v2/guide/index.html when I ran into this issue.

    Later they clarify the syntax:

    So far, we’ve only registered components globally, using Vue.component:

       Vue.component('my-component-name', {
           // ... options ...
       })
    

    Globally registered components can be used in the template of any root Vue instance (new Vue) created afterwards – and even inside all >subcomponents of that Vue instance’s component tree.

    (https://vuejs.org/v2/guide/components.html#Organizing-Components)

    So as Umesh Kadam says above, just make sure the global component definition comes before the var app = new Vue({}) instantiation.

提交回复
热议问题