You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.define 2 props in Vue component,such as "label" for string and "complexProp" for object.
2.import { defineCustomElement } from 'vue', and define custom Elements
3.in native js, setAttribute('label', 'a string value'), at the same time, update another props defined(complexProp)
4.setTimeout wait for the observer, look for the dom property "label"
like:
varcomp=document.querySelector('my-custom-component');consttest=()=>{// setAttribute('label'), at the same time, update another props definedcomp.setAttribute('label','update by setAttribute');comp.complexProp={content: 'update another props'};// the label update is not reflected in the componentsetTimeout(()=>{console.log('setTimeout wait for the observer.');console.assert(comp.label==='update by setAttribute');},0);};onload=()=>{test();};
What is expected?
expect: the property "label" should be updated.
What is actually happening?
actual: the "label" update is not reflected in the component.
Vue version
3.5.13
Link to minimal reproduction
https://calvin-ling.github.io/vue3-define-custom-comp-issue/issue.html
Steps to reproduce
1.define 2 props in Vue component,such as "label" for string and "complexProp" for object.
2.import { defineCustomElement } from 'vue', and define custom Elements
3.in native js, setAttribute('label', 'a string value'), at the same time, update another props defined(complexProp)
4.setTimeout wait for the observer, look for the dom property "label"
like:
What is expected?
expect: the property "label" should be updated.
What is actually happening?
actual: the "label" update is not reflected in the component.
System Info
Any additional comments?
may be it can use
attributeChangedCallback
The text was updated successfully, but these errors were encountered: