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
Dynamic modals #10
Comments
Hi @dominykasgithub, Glad to receive your feedback. If this feature is necessary and urgent for you, maybe you should continue to use |
@hunterliu1003 Thx, don't rush, make it good :) |
The feature of
I will keep testing the new feature, and officially release it until stable and document ready |
Thanks, I'm interested how good this works :) 👍 |
@hunterliu1003 even without docs maybe you could provide basic usage example, I tried
but it's not right, I tried looking into this code snippet
it looks that it should be something like from my first example |
@Saltibarsciai thanks for your advice. You can check out the docs from here temporarily. https://github.com/vue-final/vue-final-modal/blob/feature%2Fzh-Hant/docs/content/en/dynamic-modal.md You have to add <div>
...
<modals-container></modals-container>
</div> |
thanks! |
Thank you very much for your modal and dynamic modal feature! On problem I have with dynamic modals: Could you give me an example how I should do it? Edit: I also can't find a way to close the modal again (set Thank you! This is my current setup: <template>
<vue-final-modal
@beforeOpen="open"
v-model="state.show"
name="user-info-modal">
<template v-slot="{ params }">
Hello {{ params }}
</template>
</vue-final-modal>
</template>
<script>
import {
onMounted,
reactive,
} from 'vue';
export default {
setup(props, context) {
const state = reactive({
show: false,
});
const open = e => {
console.log(e.ref.params); // is empty proxy
}
onMounted(_ => {
state.show = true;
});
return {
open,
state,
}
},
}
</script> and from another component I call import MyModal from 'MyModal.vue';
$vfm.show({
component: MyModal
}, {
param1: 'Foo',
param2: 'Bar',
}) |
Hi @v1r0x, Thanks for your feedback.
In addition, I think In my opinion, using I would pass props import MyModal from 'MyModal.vue';
$vfm.show({
component: MyModal,
bind: {
param1: 'Foo',
param2: 'Bar',
}
}) So that you can get these props in <template>
<vue-final-modal v-model="state.show" name="user-info-modal">
<p>Hello {{ param1 }} and {{ param2 }}</p>
</vue-final-modal>
</template>
<script>
import { onMounted, reactive } from 'vue'
export default {
props: {
param1: {
type: String,
default: ''
}
param2: {
type: String,
default: ''
}
},
setup(props, context) {
const state = reactive({
show: false
})
return {
open,
state
}
}
}
</script> I think this is a more concise way. |
Thanks for your reply. I'm fine with props 👍 I just thought it was a bug 😉 I already used this way as workaround. Good to know it is the intended way 😊 Thanks again. Very happy with it so far! 🎉 |
Yes, this is a bug 😂, and I’ll fix it as soon as posible. |
I prefer |
Hello,
I'm transitioning from vue2 to vue3 and I was using vue-js-modal, but owner won't update package for a year as you can see his reply here (euvl/vue-js-modal#626)
So I decided to use this modal but it lacks features, so I'll build them myself, but I want to suggest copying dynamic modals creations like:
The text was updated successfully, but these errors were encountered: