@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
39 lines (38 loc) • 1.03 kB
JavaScript
import "../../components/spin/index.mjs";
import { createVNode as c, render as s, nextTick as i } from "vue";
import { isObject as a } from "@vexip-ui/utils";
import u from "../../components/spin/spin.vue2.mjs";
function p(o, t) {
const e = a(t.value) ? { ...t.value } : { active: t.value };
e.inner = !0;
const n = c(u, e, null, 0, Object.keys(e)), r = getComputedStyle(o).position;
o.__loading = {
spin: n,
props: e,
originPosition: r
}, r === "static" && (o.style.position = "relative"), s(n, o);
}
const v = {
mounted(o, t) {
i(() => p(o, t));
},
updated(o, t) {
i(() => {
if (!o.__loading) {
p(o, t);
return;
}
const e = a(t.value) ? t.value : { active: t.value }, n = o.__loading.spin.component;
n && (Object.keys(e).forEach((r) => {
n.props[r] = e[r];
}), n.props.inner = !0);
});
},
beforeUnmount(o) {
o.__loading && (s(null, o), delete o.__loading);
}
};
export {
v as vLoading
};
//# sourceMappingURL=index.mjs.map