You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
3.4 KiB
82 lines
3.4 KiB
import { defineComponent, openBlock, createBlock, resolveDynamicComponent, mergeProps, unref, withCtx, createElementBlock, Fragment, renderSlot, normalizeClass, createCommentVNode } from 'vue';
|
|
import { ElIcon } from '../../icon/index.mjs';
|
|
import '../../../hooks/index.mjs';
|
|
import { useButton } from './use-button.mjs';
|
|
import { buttonProps, buttonEmits } from './button.mjs';
|
|
import { useButtonCustomStyle } from './button-custom.mjs';
|
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
|
|
const __default__ = defineComponent({
|
|
name: "ElButton"
|
|
});
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
...__default__,
|
|
props: buttonProps,
|
|
emits: buttonEmits,
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const buttonStyle = useButtonCustomStyle(props);
|
|
const ns = useNamespace("button");
|
|
const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
|
|
expose({
|
|
ref: _ref,
|
|
size: _size,
|
|
type: _type,
|
|
disabled: _disabled,
|
|
shouldAddSpace
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
|
|
ref_key: "_ref",
|
|
ref: _ref
|
|
}, unref(_props), {
|
|
class: [
|
|
unref(ns).b(),
|
|
unref(ns).m(unref(_type)),
|
|
unref(ns).m(unref(_size)),
|
|
unref(ns).is("disabled", unref(_disabled)),
|
|
unref(ns).is("loading", _ctx.loading),
|
|
unref(ns).is("plain", _ctx.plain),
|
|
unref(ns).is("round", _ctx.round),
|
|
unref(ns).is("circle", _ctx.circle),
|
|
unref(ns).is("text", _ctx.text),
|
|
unref(ns).is("link", _ctx.link),
|
|
unref(ns).is("has-bg", _ctx.bg)
|
|
],
|
|
style: unref(buttonStyle),
|
|
onClick: unref(handleClick)
|
|
}), {
|
|
default: withCtx(() => [
|
|
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 1,
|
|
class: normalizeClass(unref(ns).is("loading"))
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"]))
|
|
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
default: withCtx(() => [
|
|
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
|
]),
|
|
_: 3
|
|
})) : createCommentVNode("v-if", true),
|
|
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
key: 2,
|
|
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
}, [
|
|
renderSlot(_ctx.$slots, "default")
|
|
], 2)) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 3
|
|
}, 16, ["class", "style", "onClick"]);
|
|
};
|
|
}
|
|
});
|
|
var Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
|
|
|
|
export { Button as default };
|
|
//# sourceMappingURL=button2.mjs.map
|
|
|