Closed sepharg closed 4 years ago
Hi, can You show me the code how You define custom element?
Sure thing, here´s the import:
import vueCustomElement from 'vue-custom-element'
import Btn from './components/Btn.vue';
Vue.use(vueCustomElement);
Vue.customElement('my-btn', Btn);
And then in App.Vue
<template>
<div id="app">
<main>
<my-btn>I AM A BUTTON</my-btn>
</main>
</div>
</template>
Hi, vue-class-component
return constructor so we have to use little hack. Just change one line during custom element definition:
Vue.customElement('my-btn', Btn.prototype.constructor.options);
Regards.
thanks a lot, that works!
We´re using vue-property-decorator to implement our Vue components, having decorators such as @Prop, @Component, etc For example, a simple button:
When trying to encapsulate this component in a web-component ,we get the following runtime error and aren't able to get past it:
Is it something that we're missing, or vue-custom-element just doesn't support these custom attributes in typescript?