[Vuejs]-While using nuxt2.3.x to import async component met error with Reason: SyntaxError: Unexpected identifier

0👍

I have resolve it.
Refer:
https://github.com/nuxt/nuxt.js/blob/dev/examples/dynamic-components/pages/index.vue

My code:

HTML

...
<component 
 :is="fullcalendar" 
 :config="config" 
 :events="events" />
...

Script

...
import { async } from 'q';
...
const components={
    FullCalendar: () => import('jquery')
        .then($ => $)
        .then($ => import('vue-full-calendar'))
        .then(({ FullCalendar }) => FullCalendar)
  }
...
mounted(){
    // load async component
    (async ()=>{
      await components['FullCalendar']();
      this.fullcalendar = 'FullCalendar';
    })()
  }
...

Leave a comment