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

Question: Passing props to slot components #93

Closed
nekosaur opened this issue Aug 1, 2017 · 1 comment
Closed

Question: Passing props to slot components #93

nekosaur opened this issue Aug 1, 2017 · 1 comment

Comments

@nekosaur
Copy link
Contributor

nekosaur commented Aug 1, 2017

Say I have a multi-part component where the markup looks something like this, and I need to test some interaction between the components.

<parent :foo="bar">
  <child :bar="foo"></child>
  <child :bar="foo2"></child>
</parent>

I can mount the parent component with props, and I can add the children to the default slot

const wrapper = mount(Parent, {
  propsData: {
    foo: bar
  },
  slots: {
    default: [Child, Child]
  }
}

But what's the best way of making sure the child components get created with the prop values?

@eddyerburgh
Copy link
Owner

There isn't currently a way. I can look into this in the future, but I won't be able to for at least 3 weeks (I'm going on holiday). If you want to have a look at a way to solve I would happily accept a PR 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants