tass-ui
Version:
A high quality UI Toolkit built on Vue.js3+.
53 lines (52 loc) • 1.8 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
require("../../../theme-chalk/src/button.scss.js");
const button = require("./button.js");
const _hoisted_1 = ["type", "autofocus", "disabled"];
const _hoisted_2 = {
key: 0,
class: "tas-icon-loading"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "button",
props: button.Props,
emits: button.Emits,
setup(__props, { emit: emits }) {
const props = __props;
const classList = vue.computed(() => {
const { type, size, round, plain, circle, disabled, loading } = props;
return [
{
[`tas-button--${type}`]: type,
[`tas-button--${size}`]: size,
["is-disabled"]: disabled,
["is-loading"]: loading,
["is-round"]: round,
["is-plain"]: plain,
["is-circle"]: circle
}
];
});
function handlerClick(evt) {
emits("click", evt);
}
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("button", {
class: vue.normalizeClass(["tas-button", vue.unref(classList)]),
type: _ctx.nativeType,
autofocus: _ctx.autoFocus,
disabled: _ctx.disabled || _ctx.loading,
onClick: handlerClick
}, [
props.loading ? (vue.openBlock(), vue.createElementBlock("i", _hoisted_2)) : vue.createCommentVNode("", true),
props.icon && !props.loading ? (vue.openBlock(), vue.createElementBlock("i", {
key: 1,
class: vue.normalizeClass(props.icon)
}, null, 2)) : vue.createCommentVNode("", true),
vue.renderSlot(_ctx.$slots, "default")
], 10, _hoisted_1);
};
}
});
exports.default = _sfc_main;