feat: table action 支持传入按钮样式,不传默认link
parent
1cb00f1470
commit
eeb3fc0898
|
@ -1,7 +1,5 @@
|
||||||
<!-- add by 星语:参考 vben2 的方式,增加 TableAction 组件 -->
|
<!-- add by 星语:参考 vben2 的方式,增加 TableAction 组件 -->
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ButtonType } from 'ant-design-vue/es/button';
|
|
||||||
|
|
||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
|
|
||||||
import type { ActionItem, PopConfirm } from './typing';
|
import type { ActionItem, PopConfirm } from './typing';
|
||||||
|
@ -69,7 +67,7 @@ const getActions = computed(() => {
|
||||||
.map((action) => {
|
.map((action) => {
|
||||||
const { popConfirm } = action;
|
const { popConfirm } = action;
|
||||||
return {
|
return {
|
||||||
type: 'link' as ButtonType,
|
type: action.type || 'link',
|
||||||
...action,
|
...action,
|
||||||
...popConfirm,
|
...popConfirm,
|
||||||
onConfirm: popConfirm?.confirm,
|
onConfirm: popConfirm?.confirm,
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes';
|
import type {
|
||||||
|
ButtonProps,
|
||||||
|
ButtonType,
|
||||||
|
} from 'ant-design-vue/es/button/buttonTypes';
|
||||||
import type { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip';
|
import type { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip';
|
||||||
|
|
||||||
export interface PopConfirm {
|
export interface PopConfirm {
|
||||||
|
@ -13,6 +16,7 @@ export interface PopConfirm {
|
||||||
|
|
||||||
export interface ActionItem extends ButtonProps {
|
export interface ActionItem extends ButtonProps {
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
|
type?: ButtonType;
|
||||||
label?: string;
|
label?: string;
|
||||||
color?: 'error' | 'success' | 'warning';
|
color?: 'error' | 'success' | 'warning';
|
||||||
icon?: string;
|
icon?: string;
|
||||||
|
|
Loading…
Reference in New Issue