출처 :: https://www.npmjs.com/package/vue-loading-overlay
데모 :: https://ankurk91.github.io/vue-loading-overlay/
설치 :: npm install vue-loading-overlay@^5.0
import {createApp} from 'vue';
import VueLoading from 'vue-loading-overlay';
import 'vue-loading-overlay/dist/vue-loading.css';
// Your app initialization logic goes here
const app = createApp({});
app.use(VueLoading);
app.mount('#app');
with Composition API
setup() {
const $loading = useLoading()
// or use inject without importing useLoading
// const $loading = inject('$loading')
const fullPage = ref(false)
const submit = () => {
const loader = $loading.show({
// Optional parameters
});
// simulate AJAX
setTimeout(() => {
loader.hide()
}, 5000)
}
const onCancel = () => console.log('User cancelled the loader.')
return {
fullPage,
submit,
onCancel
}
}