Vue.js: check if a component exists

前端 未结 6 1257
天命终不由人
天命终不由人 2021-02-12 13:26

I need to do some stuff in the ready: of the root instance only when some components don\'t exist (they weren\'t declared in the HTML).

How can I check if a

6条回答
  •  孤街浪徒
    2021-02-12 14:06

    get the current component imported components

    this.$options.components[findComponentName]
    

    get the global components

    Vue.$options.components[findComponentName]
    

提交回复
热议问题