search

Home  >  Q&A  >  body text

javascript - When using a Vue single file component, the referenced component needs to be written at least 3 times. Is there an easier way to make the component globally available and directly available?

As shown:

黄舟黄舟2746 days ago451

reply all(2)I'll reply

  • 某草草

    某草草2017-05-19 10:34:42

    Register global components under main.js:
    import btn from '@/components/btn'
    Vue.component('btn',btn)

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-19 10:34:42

    I don’t know if you are talking about Vue.components('hello', hello)

    reply
    0
  • Cancelreply