UNPKG

hongluan-ui

Version:
63 lines (58 loc) 2.42 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); require('../../../hooks/index.js'); var index$1 = require('../../spinner/index.js'); var useButton = require('./use-button.js'); var button = require('./button.js'); var index = require('../../../hooks/use-namespace/index.js'); const __default__ = vue.defineComponent({ name: "Button" }); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: button.buttonProps, emits: button.buttonEmits, setup(__props, { expose, emit }) { const props = __props; const { namespace } = index.useNamespace("button"); const { _ref, _props, buttonDisabled, buttonSize, handleClick } = useButton.useButton(props, emit); expose({ ref: _ref, size: buttonSize, disabled: buttonDisabled }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({ ref_key: "_ref", ref: _ref, class: [ vue.unref(namespace), _ctx.type ? _ctx.type : "", vue.unref(buttonSize) ? vue.unref(buttonSize) : "", _ctx.iconPosition ? "icon-" + _ctx.iconPosition : "", _ctx.effect ? _ctx.effect : "", { "is-disabled": vue.unref(buttonDisabled), "is-loading": _ctx.loading, "equal": _ctx.equal, "round": _ctx.round, "block": _ctx.block, "no-fill": _ctx.noFill, "rational": _ctx.rational } ] }, vue.unref(_props), { onClick: vue.unref(handleClick) }), [ _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(index$1.HlSpinner), { key: 1 })) ], 2112)) : vue.createCommentVNode("v-if", true), _ctx.$slots.icon && !_ctx.loading ? vue.renderSlot(_ctx.$slots, "icon", { key: 1 }) : vue.createCommentVNode("v-if", true), _ctx.$slots.default && (_ctx.loading || _ctx.$slots.icon) ? (vue.openBlock(), vue.createElementBlock("span", { key: 2 }, [ vue.renderSlot(_ctx.$slots, "default") ])) : vue.renderSlot(_ctx.$slots, "default", { key: 3 }) ], 16, ["onClick"]); }; } }); exports["default"] = _sfc_main; //# sourceMappingURL=button2.js.map