Add an example about changing modal content from js #147
-
|
Hi, I would like to design a modal dialog in Vue2 and to be able to call it from js to display different content. I would like to do the same with vue-final-modal. I have added inside main.js the following code: Then inside App.Vue: I have added the CustomModal.vue and inside the vue where I would like to display the modal I have added the lines below: But then how can I write the showDialog function to replace title and content ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @vricosti, Here is the docs example of Maybe like this, you can checkout the DynamicModalOptions type import CustomModal from '@/components/CustomModal.vue'
export default {
methods: {
showDialog() {
this.$vfm.show({
component: CustomModal,
on: {
confirm() { ... },
cancel() { ... },
},
slot: {
title: '<span>Hello, vue-final-modal</span>',
default: '<p>Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.</p>'
// or
default: {
component: DefaultSlotComponent,
bind: { /* ...props for DefaultSlotComponent */ },
on: { /* ...events for DefaultSlotComponent */ }
}
}
})
}
} |
Beta Was this translation helpful? Give feedback.
Hi @vricosti,
Here is the docs example of
Dynamic Modalhttps://vue-final-modal.org/dynamic-modal#advanced
Maybe like this, you can checkout the DynamicModalOptions type