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>

100 lines (99 loc) 3.42 kB
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, createCommentVNode, renderSlot, createBlock, resolveDynamicComponent, createTextVNode, toDisplayString } from "vue"; import { resultProps } from "./types.mjs"; import { IconDanger, IconWarning, IconSuccess, IconInfo } from "../_utils/icons.mjs"; const _hoisted_1 = { key: 0, class: "o-result-image" }; const _hoisted_2 = { key: 1, class: "o-result-header" }; const _hoisted_3 = { key: 1, class: "o-result-title" }; const _hoisted_4 = { key: 2, class: "o-result-description" }; const _hoisted_5 = { key: 3, class: "o-result-extra" }; const _hoisted_6 = { key: 4, class: "o-result-content" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "OResult", props: resultProps, setup(__props) { const props = __props; const iconMap = { info: IconInfo.value, success: IconSuccess.value, warning: IconWarning.value, danger: IconDanger.value }; const icon = computed(() => props.status ? iconMap[props.status] : void 0); return (_ctx, _cache) => { return openBlock(), createElementBlock( "div", { class: normalizeClass(["o-result", { [`o-result-${props.status}`]: props.status }]) }, [ _ctx.$slots.image ? (openBlock(), createElementBlock("div", _hoisted_1, [ renderSlot(_ctx.$slots, "image") ])) : createCommentVNode("v-if", true), props.status || _ctx.$slots.icon || props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", _hoisted_2, [ props.status || _ctx.$slots.icon ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(["o-result-icon", { "o-result-icon-custom": _ctx.$slots.icon }]) }, [ renderSlot(_ctx.$slots, "icon", {}, () => [ (openBlock(), createBlock(resolveDynamicComponent(icon.value))) ]) ], 2 /* CLASS */ )) : createCommentVNode("v-if", true), props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", _hoisted_3, [ renderSlot(_ctx.$slots, "title", {}, () => [ createTextVNode( toDisplayString(props.title), 1 /* TEXT */ ) ]) ])) : createCommentVNode("v-if", true) ])) : createCommentVNode("v-if", true), props.description || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_4, [ renderSlot(_ctx.$slots, "description", {}, () => [ createTextVNode( toDisplayString(props.description), 1 /* TEXT */ ) ]) ])) : createCommentVNode("v-if", true), _ctx.$slots.extra ? (openBlock(), createElementBlock("div", _hoisted_5, [ renderSlot(_ctx.$slots, "extra") ])) : createCommentVNode("v-if", true), _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_6, [ renderSlot(_ctx.$slots, "default") ])) : createCommentVNode("v-if", true) ], 2 /* CLASS */ ); }; } }); export { _sfc_main as default };