sreenaths / vue3-webcomponent-wrapper-demo

Demo app for vue3-webcomponent-wrapper
Apache License 2.0
3 stars 4 forks source link

Support for async components #4

Open dryton opened 3 years ago

dryton commented 3 years ago

Vue 3 introduced defineAsyncComponent as a way to create components that load asynchronously: https://v3.vuejs.org/api/global-api.html#defineasynccomponent

When you pass an async component to the wrapper it will load the component, but it fails to map props from the custom element through to the component.

You can test this out in your demo by updating main.js to:

import { createApp, defineAsyncComponent, h } from "vue";
import wrapper from "vue3-webcomponent-wrapper";
const Counter = defineAsyncComponent(() => import("./components/Counter.vue"));

const webComponent = wrapper(Counter, createApp, h);
window.customElements.define("demo-counter", webComponent);