Skip to content
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

fix: set wrapper.vm if the element binds Vue instance #724

Merged
merged 6 commits into from
Jun 18, 2018

Conversation

38elements
Copy link
Contributor

This is related to #687.

@eddyerburgh
Copy link
Member

Can you check in createWrapper if there is a componentInstance, and if there is return a wrapper using componentInstance?

export default function createWrapper (
  node: VNode | Component,
  options: WrapperOptions
) {
  if (node.componentInstance) {
    return new VueWrapper(node.componentInstance, options)
  }
  return node instanceof Vue
    ? new VueWrapper(node, options)
    : new Wrapper(node, options)
}

@38elements
Copy link
Contributor Author

Thank you for reviewing.
I changed it.

@eddyerburgh
Copy link
Member

If that works then I think you can remove the extra code in this PR?

@38elements
Copy link
Contributor Author

38elements commented Jun 17, 2018

No, it is not.
I think that it is necessary to get a component instance from vm.$children.

@38elements
Copy link
Contributor Author

I think that the following code is not necessary if this change code exists.

  if (node.componentInstance) {
    return new VueWrapper(node.componentInstance, options)
  }

@eddyerburgh
Copy link
Member

Why is it necessary to get the instance from vm.$children?

I thought we could keep the same logic for getting vnodes. Then we could check that if the vnode is for a component instance in the create-wrapper function.

@38elements
Copy link
Contributor Author

I misunderstood.
This passed at 2.5.
I will fix it.

@38elements
Copy link
Contributor Author

I fixed it.
VNode.child was changed to VNode.componentInstance at 2.1.9.
vuejs/vue@ced2dfc

@eddyerburgh eddyerburgh merged commit b14afae into vuejs:dev Jun 18, 2018
@38elements 38elements deleted the wrapper branch June 19, 2018 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants