-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vnode props can't be accessed from parent #1186
Comments
const active = vnode.props.href === props.modelValue
const wasActive = vnode.props.active// it is origin vnode props. it hasn't active props.
console.log(vnode.props.href, wasActive)
console.log(vnode.props.href, active) // it will be expect to you.
return Vue.cloneVNode(vnode, {
onActivate(newHref) {
emit("update:modelValue", newHref);
},
active// change origin vnode props. add active props.
});
}); Please read the code comment, hope help to you. |
Thanks @underfin . I intentionally have two variables:
However it only makes sense in |
For every update will create new children, and each of the new child never has active props. |
Thanks @underfin . I realized that as well after I replied. I made a change and it now works. Not sure if it is good practice or not, but it works: https://codepen.io/lzhoucs/pen/jObeqvb Close the ticket since there's no bug to fix but a mistake on my side. |
Version
3.0.0-beta.12
Reproduction link(either one of the following)
Steps to reproduce
What is expected?
true/false is logged
What is actually happening?
undefined
is loggedI need to access Tab's active prop inside Tabs, I found no way to do it. This ticket is similar to #1082. The only difference is this ticket has issue getting child vnode props from parent whereas #1082 had issue setting it.
In both reproduction links, the
console.log(vnode.props.active)
shows undefined when either tab is clicked, even thoughvnode.props.active
can be set properly from parent now that #1082 is fixedThe text was updated successfully, but these errors were encountered: