yanzhen-design-vue
Version:
51 lines (50 loc) • 1.75 kB
JavaScript
import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
import { Button } from "ant-design-vue";
import { useButton } from "./use-button.mjs";
import { buttonName, buttonProps, buttonEmits, buttonOptions } from "./button.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
...{ name: buttonName },
__name: "button",
props: buttonProps,
emits: buttonEmits,
setup(__props, { expose: __expose, emit: __emit }) {
var _a, _b;
const { ns } = buttonOptions;
const props = __props;
const emit = __emit;
const { _ref, _props, _disabled, handleClick, handleMousedown, _text } = useButton(props, emit);
__expose({
/** @description button html element */
ref: _ref,
/** @description button size */
size: _props.value.size,
/** @description button type */
type: _props.value.type,
/** @description button disabled */
disabled: _disabled,
blur: (_a = _ref.value) == null ? void 0 : _a.blur,
focus: (_b = _ref.value) == null ? void 0 : _b.focus
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(Button), mergeProps({
ref_key: "_ref",
ref: _ref,
class: [unref(ns).b()]
}, unref(_props), {
disabled: unref(_disabled),
onClick: unref(handleClick),
onMousedown: unref(handleMousedown)
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(unref(_text)), 1)
])
]),
_: 3
}, 16, ["class", "disabled", "onClick", "onMousedown"]);
};
}
});
export {
_sfc_main as default
};