-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Feature: reverse lookup element to vm #105
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
Might be slightly complicated for slots, because for slots the closest element with viewmodel bound to it is not the viewmodel the data comes from. var Home = {
template: `
<div>
<tab-group>
<tab-page v-for="tab in tabs">
<div>{{ <belongs to "home" vm, not to "tab-page" vm> }}</div>
</tab-page>
</tab-group>
</div>
`,
}; |
@simplesmiler Any luck with this... I don't see that there is many other tools with this capability. |
I think the best way to do that would be to inject a vm reference into every element this vm governs. It's already done with root elements ( Don't have time to try to implement it yet. UPDATE: Should not inject |
Another complication is that in Vue 2 element may belong to multiple instances. The example below is producing a fragment (elementless) instance in Vue 1, but in Vue 2 it is absolutely valid. The Example: https://jsfiddle.net/simplesmiler/5LydL0hz/ I see two options:
|
I'm not sure it's worth the hassle actually. I don't see any interest around this functionality since it was proposed, so I'm going to close it now, and we'll rather focus on more vital things :) |
It's possible to "Inspect DOM" for given vm, and Chrome will open "Elements" panel and select the root element of vm.
It would be helpful, if there was a way to do the reverse of that. Given the element, open "Vue Devtools" panel and select the vm this element is governed by (if any).
The text was updated successfully, but these errors were encountered: