D
D
devilsD2018-08-16 22:23:52
Vue.js
devilsD, 2018-08-16 22:23:52

How to asynchronously import a VUE component?

It is necessary to asynchronously import vue2-editor https://github.com/davidroyer/vue2-editor
If I do this, then an error occurs.

Vue.component(
  'vue-editor', 
  () => import('vue2-editor')
)

the documentation says that it needs to be imported into an object:
import { VueEditor } from 'vue2-editor'
how to implement it asynchronously

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-16
@devilsD

the documentation says that it needs to be imported into an object:
import { VueEditor } from 'vue2-editor'

Well then try this very VueEditor when importing and give:
Vue.component('vue-editor', () => import('vue2-editor').then(c => c.VueEditor));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question