@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>
75 lines (74 loc) • 2.87 kB
JavaScript
import { defineComponent, ref, createBlock, openBlock, unref, withCtx, renderSlot, createElementVNode, createElementBlock, createCommentVNode, resolveDynamicComponent, normalizeClass, createTextVNode, toDisplayString } from "vue";
import { IconLoading } from "../_utils/icons.mjs";
import { OLayer } from "../layer/index.mjs";
import { loadingProps } from "./types.mjs";
import { mergeClass } from "../_utils/dom.mjs";
const _hoisted_1 = { class: "o-loading-icon" };
const _hoisted_2 = {
key: 0,
class: "o-loading-label"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "OLoading",
props: loadingProps,
emits: ["change", "update:visible"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const layerRef = ref(null);
__expose({
toggle(show) {
var _a;
(_a = layerRef.value) == null ? void 0 : _a.toggle(show);
}
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(OLayer), {
ref_key: "layerRef",
ref: layerRef,
class: "o-loading",
visible: props.visible,
wrapper: props.wrapper,
"unmount-on-hide": props.unmountOnHide,
"main-class": unref(mergeClass)("o-loading-main", props.mainClass),
"main-transition": props.mainTransition,
"mask-transition": props.maskTransition,
"transition-orign": "css",
mask: props.mask,
"mask-close": false,
onChange: _cache[0] || (_cache[0] = (v) => emits("change", v)),
"onUpdate:visible": _cache[1] || (_cache[1] = (v, e) => emits("update:visible", v, e))
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
createElementVNode("div", _hoisted_1, [
renderSlot(_ctx.$slots, "icon", {}, () => [
props.icon ? (openBlock(), createBlock(resolveDynamicComponent(props.icon), {
key: 0,
class: normalizeClass({ "o-rotating": props.iconRotating })
}, null, 8, ["class"])) : (openBlock(), createBlock(unref(IconLoading), {
key: 1,
class: "o-rotating"
}))
])
]),
_ctx.$slots.label || props.label ? (openBlock(), createElementBlock("div", _hoisted_2, [
renderSlot(_ctx.$slots, "label", {}, () => [
createTextVNode(
toDisplayString(props.label),
1
/* TEXT */
)
])
])) : createCommentVNode("v-if", true)
])
]),
_: 3
/* FORWARDED */
}, 8, ["visible", "wrapper", "unmount-on-hide", "main-class", "main-transition", "mask-transition", "mask"]);
};
}
});
export {
_sfc_main as default
};