Jenesius / vue-modal

🖖The progressive and simple modal system for Vue.js v3
https://modal.jenesius.com
MIT License
142 stars 14 forks source link

How can I pass the slot #115

Open drdevelop opened 3 months ago

drdevelop commented 3 months ago

pass vue component slot

Jenesius commented 3 months ago

Hello, just transferring to the slot will not work. I prefer to create modal windows with the required slots. It looks something like this:

// other-component.vue
<widget-modal>
  <template #header> Test {{label}}</template>
</widget-modal>

And then

import OtherComponent from "./other-component.vue"
openModal(OtherComponent, { label: "Header" })

Also u can try to do something like this:


openModal({
  template: `
  <widget-modal>
    <template #header> Test {{label}}</template>
  </widget-modal>
  `,
  components: {WidgetModal}
}, { label: "Header" })
drdevelop commented 3 months ago

It looks like additionally bridging a component to pass the slot. It a little trouble. Is there a simple better way to achieve it?