I'm facing an issue with a Vue component that I've defined using Vue class components. Here is the code snippet:
@Component
export default class MyComponent extends Vue {
value = 0;
}
My requirement is to create multiple instances of this component as root components, each with different data passed in. I attempted to achieve this by doing the following:
const vm = new Vue({
el: myElement,
render: (h) => h(MyComponent),
data: {value: 1},
});
However, upon inspection, I noticed that the value of this.value
in the component remains set to 0 instead of 1. Is there a way for me to ensure that the component is instantiated with the value passed when invoking new Vue
?