Skip to content

Support for async components #323

@mtatarau90

Description

@mtatarau90

Hi, guys

I try to lazy load some components, and work fine if i use the classic way with: my-component': () => import('./my-async-component'), but i want try to create a factory object like in vue documentation

const AsyncComponent = () => ({
  // The component to load (should be a Promise)
  component: import('./MyComponent.vue'),
  // A component to use while the async component is loading
  loading: LoadingComponent,
  // A component to use if the load fails
  error: ErrorComponent,
  // Delay before showing the loading component. Default: 200ms.
  delay: 200,
  // The error component will be displayed if a timeout is
  // provided and exceeded. Default: Infinity.
  timeout: 3000
})

@Component({
  components: {
    AsyncComponent
  }
})
class App extends Vue {}

But it gave me an error " Object literal may only specify known properties, but 'components' does not exist in type 'VueClass'. Did you mean to write 'component'?".

Now my question is, i do something wrong? or vue-class-component do not support this feature?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions