Closed stoivo closed 4 years ago
Hi, I'm not into TS (yet) but looking at documentation (https://github.com/kaorun343/vue-property-decorator#Prop) and changing prop definition to:
@Prop({
type: String,
default: undefined
})
readonly name: string | undefined;
seems to work fine.
When I change the attribute I get this warning message [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "name"
. I dont see it in the example app you shared and I wont know why.
I've changed prop definition according to docs - last part
readonly name: string | undefined;
And it works.
Any ideas how to get around initilizing a new instance when defining the custom element?
I didn't test it but it seems that instead of
new App().$options
You can use
App.prototype.constructor.options
Hi, Thanks for a very awesome package. I have look at the orifinal official package and it is not neadly as good. Thank you.
I have a Vue component I want to abstract out as a CustomElement for an example I have
HelloApp
Single file component of `HelloApp.vue`
```vue{{ message }} {{ new Date }} :)
I have awesome styling{{ "!".repeat(counter) }}
Dont you agree, {{name}}?
Than I import the vue component as a custom element
Then in the DOM i put
All this work so far. At this moment I am having warnings
Vue.customElement('hello-app', (new HelloApp()).$options);
found in
---> at app/javascript/hello_awesome.vue