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