An easy-to-use Modal for Vue 3. Multiple modals can pop up orderly.
npm install usemodal-vue3npm i usemodal-vue3
javascript
import { ref } from 'vue';
import { Modal } from 'usemodal-vue3';
let isVisible = ref(false);
your content...
`
Use in Nuxt
`javascript
your content...
`
Your page may need to pop up multiple modals, and different modals may depend on different data sources, sometimes even asynchronously, you can easily manage their popup order.
`javascript
import { reactive } from 'vue';
import { useModal, Modal } from 'usemodal-vue3';
const setModal = useModal({
m1: 2, // The larger the number, the later in the order
m2: 1 // Smaller numbers, first in order
});
let modalVisible = reactive({});
modalVisible = setModal('m1', true);
setTimeout(() => {
// or modalVisible = setModal('m2', false)
modalVisible = setModal('m2', true); // either true or false, you have to define a state.
}, 2000)
function myCancel() {
// do something....
modalVisible = setModal('m2', false); // m2 is closed, while the other states are true in order
}
// m1 order is 2
This modal will be displayed according to the status when the previous one is closed or the display status is fasle
// m2 order is 1, will go first
This modal will be displayed first
`
If you need to use drag.
`javascript
// draggable = true. By default, hold down the title part and drag
...
// You can customize the dragged part. Especially when 'type' is 'clean'
const handle = ref();
You can hold here and drag
``