-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Accessing computed properties of components mixed into view model from JavaScript #68
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
Comments
Thanks for the question - it is an overlook in design. I will update <p v-repeat="items" v-component="item" v-component-id="items">
...
</p> vueInstance.$.items[0].isDisabled |
Landed in 2ca2d77 with casper test coverage. |
Is there a way to access computed properties of components that are "mixed into" a view model from JavaScript? The docs show how to use the
v-with
directive to access them in HTML, but not from JavaScript.Here's an example JSFiddle that illustrates the type of composition I'm referring to.
I have a component created with
Vue.extend
that I am adding to a view model using the components instantiation option. I then want to know the right way to access the computed properties of the component from the view model in JavaScript.You can access
vueInstance.$.component.computedField
if thev-component-id
directive is used, but this does not work when usingv-repeat
since the computed field will only refer to the last item in the list.I may not have the concepts down correctly, but I think there are cases where I would want to get at data from a component in code instead of markup.
The text was updated successfully, but these errors were encountered: