UNPKG

@xdp/button

Version:

button el-button vue3

57 lines (54 loc) 1.53 kB
import { defineComponent, computed, createVNode, mergeProps } from 'vue'; import { useTable, getUsingConfig } from '@d-render/shared'; import CipButton from '../cip-button'; var index = defineComponent({ name: "CipButtonText", props: { type: { type: String, default: "primary" }, size: String, danger: { type: Boolean, default: void 0 }, disabled: Boolean, showDisabled: { type: Boolean, default: void 0 } }, setup(props, { attrs, slots }) { const cipTable = useTable(); const sizeBridge = computed(() => { return getUsingConfig(props.size, cipTable.size, "default"); }); const dangerBridge = computed(() => { return getUsingConfig(props.danger, cipTable.dangerButton, true); }); const showDisabledButton = computed(() => { return getUsingConfig(props.showDisabled, cipTable.showDisabledButton, true); }); const showButton = computed(() => { if (showDisabledButton.value === false && props.disabled) return false; return true; }); return () => showButton.value && createVNode(CipButton, mergeProps(attrs, { "link": true, "disabled": props.disabled, "type": dangerBridge.value === false && props.type === "danger" ? "primary" : props.type, "size": sizeBridge.value }), { default: () => { var _a; return [(_a = slots.default) == null ? void 0 : _a.call(slots)]; } }); } }); export { index as default };