Vue.component()

Vue.component( id, [definition] )

  • Arguments:

    • {String} id
    • {Function | Object} [definition]
  • Usage:

    Register or retrieve a global component.

    1
    2
    3
    4
    5
    6
    7
    8
    // register an extended constructor
    Vue.component('my-component', Vue.extend({ /* ... */ }))
     
    // register an options object (automatically call Vue.extend)
    Vue.component('my-component', { /* ... */ })
     
    // retrieve a registered component (always return constructor)
    var MyComponent = Vue.component('my-component')
  • See also: Components.

doc_VueJS
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.