Can I pass propsData to dynamic component in template
See original GitHub issuewhen I render form.jade from columns.json , I try to pass propsData(multi props) to component , but It seems unsupported. Is there a better way to do this?
json
[ {"title": "A", "name":"a", "component": "ui-dropdown" , "propsData": {"options": [], "on":"hover" }}, {"title": "B", "name":"b", "component": "ui-dropdown" , "propsData": {"options": [] , "on":"click"}}, ]
template :
.ui.segment.form.bottom.attached .field(v-for="column in columns") label {{column.title}} component(:is="column.component", :propsData="column.propsData", :value.sync="editor[column.name]")
Of course , there is a way to pass props one by one , but it seems not so good.
.ui.segment.form.bottom.attached
.field(v-for="column in columns")
label {{column.title}}
component(:is="column.component",
:options="column.propsData.options",
:on="column.propsData.on",
:value.sync="editor[column.name]")
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Passing props dynamically to dynamic component in VueJS
To pass props dynamically, you can add the v-bind directive to your dynamic component and pass an object containing your prop names and ......
Read more >Passing props dynamically to dynamic component in VueJS ...
To pass props dynamically, you can add the v-bind directive to your dynamic component and pass an object containing your prop names and...
Read more >Pass props to dynamic Vue components - Jordan Kicklighter
This is usually done by specifying the component that will be rendered and adding a v-for to its tag in the template.
Read more >How to use props to pass data to child components in Vue.js
You can use the root component (App.vue) as the parent component and store the data and then register props to access this data...
Read more >Props | Vue.js
Technically, you can also use camelCase when passing props to a child component (except in DOM templates). However, the convention is using kebab-case...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
[UPDATE] The directive is not that ok in some situation , I have wrote a better solution
component-proxy
@fnlctrl , tks for your reply. I have wrote a directive to do this and really appreciate
vue
would add this feature in the future:template:
I have the same problem! @terrydai - this is good solution. I try it now. For now I manually create new instances and mount them in particular element like this
new MyComponent({el: '#id', propsData: {...}})