UNPKG

@opensig/opendesign

Version:

<p align="center"><img src="../docs/public/opendesign-logo-light.png"/></p> <h1 align="center">opendesign</h1> <p align="center">一个 Vue 3 组件库</p> <p align="center"><b>皮肤可定制,使用 TypeScript</b></p>

41 lines (40 loc) 1.04 kB
"use strict"; const vue = require("vue"); const OLoading_vue_vue_type_script_setup_true_lang = require("./OLoading.vue.js"); const initLoading = (opt, el) => { const vnode = vue.h(OLoading_vue_vue_type_script_setup_true_lang, Object.assign(opt || {}, { wrapper: el })); if (el) { vue.render(vnode, el); } return vnode.component; }; const useLoading = (opt, wrap = "body") => { let instance = null; if (vue.isRef(wrap)) { vue.watch( () => wrap.value, (el) => { instance = initLoading(opt, el); }, { immediate: true } ); } else if (wrap.nodeType === 1) { instance = initLoading(opt, wrap); } else if (typeof wrap === "string") { vue.onMounted(() => { const el = document.querySelector(wrap); if (el) { instance = initLoading(opt, el); } }); } return { toggle(show) { var _a; (_a = instance == null ? void 0 : instance.exposed) == null ? void 0 : _a.toggle(show); } }; }; module.exports = useLoading;