UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

73 lines (70 loc) 2.48 kB
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, createVNode, Transition, withCtx, withDirectives, vShow } from 'vue'; import { UiIcon } from '../../icon/index.mjs'; import { UiButtonPropsOption, UiButtonEmits } from './index.mjs'; import { useComposable } from './src/composable.mjs'; const _hoisted_1 = ["type", "disabled"]; const _hoisted_2 = { key: 0, class: "ui-mask ui-loading" }; const __default__ = defineComponent({ name: "UiButton" }); var _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, props: UiButtonPropsOption, emits: UiButtonEmits, setup(__props, { expose: __expose, emit: __emit }) { ; const define = __props; const emits = __emit; const { computeds, methods, status } = useComposable(define, emits); const { className, style } = computeds; const { click } = methods; __expose({ click }); return (_ctx, _cache) => { return openBlock(), createElementBlock( "div", { class: normalizeClass(["ui-button", unref(className)]) }, [ createCommentVNode(" \u6309\u94AE\u4E3B\u4F53 "), createElementVNode("button", { class: "ui-button-main", type: _ctx.nativeType, style: normalizeStyle(unref(style)), disabled: _ctx.disabled, onClick: _cache[0] || (_cache[0] = //@ts-ignore (...args) => unref(click) && unref(click)(...args)) }, [ renderSlot(_ctx.$slots, "default") ], 12, _hoisted_1), createCommentVNode(" \u906E\u7F69\u5C42 "), createVNode(Transition, null, { default: withCtx(() => [ unref(status).name == "loading" ? (openBlock(), createElementBlock("div", _hoisted_2, [ withDirectives(createVNode( unref(UiIcon), { name: "loading", class: "ui-mask-icon" }, null, 512 /* NEED_PATCH */ ), [ [vShow, unref(status).is] ]) ])) : createCommentVNode("v-if", true) ]), _: 1 /* STABLE */ }) ], 2 /* CLASS */ ); }; } }); export { _sfc_main as default }; //# sourceMappingURL=index.vue2.mjs.map