tass-ui
Version:
A high quality UI Toolkit built on Vue.js3+.
53 lines (52 loc) • 1.73 kB
JavaScript
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, createCommentVNode, renderSlot } from "vue";
import "../../../theme-chalk/src/button.scss.mjs";
import { Props, Emits } from "./button.mjs";
const _hoisted_1 = ["type", "autofocus", "disabled"];
const _hoisted_2 = {
key: 0,
class: "tas-icon-loading"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "button",
props: Props,
emits: Emits,
setup(__props, { emit: emits }) {
const props = __props;
const classList = 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 openBlock(), createElementBlock("button", {
class: normalizeClass(["tas-button", unref(classList)]),
type: _ctx.nativeType,
autofocus: _ctx.autoFocus,
disabled: _ctx.disabled || _ctx.loading,
onClick: handlerClick
}, [
props.loading ? (openBlock(), createElementBlock("i", _hoisted_2)) : createCommentVNode("", true),
props.icon && !props.loading ? (openBlock(), createElementBlock("i", {
key: 1,
class: normalizeClass(props.icon)
}, null, 2)) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
], 10, _hoisted_1);
};
}
});
export {
_sfc_main as default
};