ivue-material-plus
Version:
A high quality UI components Library with Vue.js
76 lines (74 loc) • 1.72 kB
JavaScript
import { createApp, getCurrentInstance, h } from 'vue';
import Spin from './index2.mjs';
export { default } from './index2.mjs';
import { transferIncrease, transferIndex } from '../../utils/transfer-queue.mjs';
const handleGetIndex = () => {
transferIncrease();
return transferIndex;
};
let tIndex = handleGetIndex();
Spin.newInstance = (props = {}) => {
let _instance = null;
const Instance = createApp({
data() {
return Object.assign({}, props);
},
created() {
_instance = getCurrentInstance();
},
render() {
let vnode = null;
if (this.render) {
vnode = h(
Spin,
{
fix: true,
fullscreen: true,
ref: "spin"
},
{
default: () => this.render(h)
}
);
} else {
vnode = h(Spin, {
size: "large",
fix: true,
fullscreen: true,
ref: "spin"
});
}
return h(
"div",
{
class: "ivue-spin-fullscreen ivue-spin-fullscreen--wrapper",
style: {
"z-index": 2010 + tIndex
}
},
[vnode]
);
}
});
const container = document.createElement("div");
document.body.appendChild(container);
Instance.mount(container);
const spin = _instance.refs.spin;
return {
show() {
spin.visible = true;
tIndex = handleGetIndex();
},
remove(callback = () => {
}) {
spin.visible = false;
setTimeout(() => {
Instance.unmount();
document.body.removeChild(container);
callback();
}, 300);
},
component: spin
};
};
//# sourceMappingURL=spin.mjs.map