在 buefy/bulma 模态组件中传递道具(nuxtjs)
Passing props in buefy/bulma modal component (nuxtjs)
如何将道具传递给要用作 Buefy/Bulma 模态模板的自定义组件?
这是我声明组件的方式
import myCustomComponent from '~/components/myCustomComponent'
export default {
components: {
myCustomComponent ,
},
methods: {
openModal(prop) {
this.$buefy.modal.open({
parent: this,
// here I want to pass my 'prop' to myCustomComponent
// the equivalent of <myCustomComponent :prop='prop' />
component: myCustomComponent,
hasModalCard: true,
customClass: 'custom-class custom-class-2',
trapFocus: true,
})
},
}
如何将 prop 传递给组件?谢谢
我知道这是一个超级晚的回复,但希望这对以后看到这个的人有所帮助。
import myCustomComponent from '~/components/myCustomComponent'
export default {
components: {
myCustomComponent ,
},
methods: {
openModal(prop) {
this.$buefy.modal.open({
parent: this,
component: myCustomComponent,
props: {
// You can pass your props to the component here
prop
},
hasModalCard: true,
customClass: 'custom-class custom-class-2',
trapFocus: true,
})
},
}
如何将道具传递给要用作 Buefy/Bulma 模态模板的自定义组件?
这是我声明组件的方式
import myCustomComponent from '~/components/myCustomComponent'
export default {
components: {
myCustomComponent ,
},
methods: {
openModal(prop) {
this.$buefy.modal.open({
parent: this,
// here I want to pass my 'prop' to myCustomComponent
// the equivalent of <myCustomComponent :prop='prop' />
component: myCustomComponent,
hasModalCard: true,
customClass: 'custom-class custom-class-2',
trapFocus: true,
})
},
}
如何将 prop 传递给组件?谢谢
我知道这是一个超级晚的回复,但希望这对以后看到这个的人有所帮助。
import myCustomComponent from '~/components/myCustomComponent'
export default {
components: {
myCustomComponent ,
},
methods: {
openModal(prop) {
this.$buefy.modal.open({
parent: this,
component: myCustomComponent,
props: {
// You can pass your props to the component here
prop
},
hasModalCard: true,
customClass: 'custom-class custom-class-2',
trapFocus: true,
})
},
}