From de499a145556427304abe075b62e6869f44dc640 Mon Sep 17 00:00:00 2001 From: vben <anncwb@126.com> Date: 星期六, 28 十一月 2020 17:25:35 +0800 Subject: [PATCH] fix: fix the display problem of table icon --- src/views/demo/table/FixedColumn.vue | 1 + src/components/Table/src/style/index.less | 5 +++++ src/components/Table/src/components/TableAction.tsx | 11 ++++++----- CHANGELOG.zh_CN.md | 9 +++++---- src/components/Table/src/types/tableAction.ts | 6 ++---- src/components/registerGlobComp.ts | 2 ++ 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 60f977c..04d9bf9 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -26,10 +26,11 @@ ### 馃悰 Bug Fixes -- 淇 tree 鏂囨湰瓒呭嚭鎸′綇鎿嶄綔鎸夐挳闂 -- 淇閫氳繃 useRedo 鍒锋柊椤甸潰鍙傛暟涓㈠け闂 -- 淇琛ㄥ崟鏍¢獙鍏堣缃湪鏍¢獙鍙婃帶鍒跺彴閿欒淇℃伅闂 -- 淇`modal`涓巂drawer`缁勪欢浼犻�掓暟缁勫弬鏁伴棶棰� +- tree: 淇鏂囨湰瓒呭嚭鎸′綇鎿嶄綔鎸夐挳闂 +- useRedo: 淇閫氳繃 useRedo 鍒锋柊椤甸潰鍙傛暟涓㈠け闂 +- form: 淇琛ㄥ崟鏍¢獙鍏堣缃湪鏍¢獙鍙婃帶鍒跺彴閿欒淇℃伅闂 +- `modal`&`drawer` 淇缁勪欢浼犻�掓暟缁勫弬鏁伴棶棰� +- form: 淇`updateSchema`璧嬪�煎惈鏈塦[]`鏃朵笉鐢熸晥 ### 馃帿 Chores diff --git a/src/components/Table/src/components/TableAction.tsx b/src/components/Table/src/components/TableAction.tsx index 28b2d1b..a889b61 100644 --- a/src/components/Table/src/components/TableAction.tsx +++ b/src/components/Table/src/components/TableAction.tsx @@ -24,20 +24,20 @@ }, setup(props) { function renderButton(action: ActionItem, index: number) { - const { disabled = false, label, icon, color = '', type = 'link' } = action; + const { disabled = false, label, icon, color = '', type = 'link', ...actionProps } = action; const button = ( <Button - type={type as any} + type={type} size="small" disabled={disabled} color={color} - {...action} + {...actionProps} key={`${index}-${label}`} > {() => ( <> + {icon && <Icon icon={icon} class="mr-1" />} {label} - {icon && <Icon icon={icon} />} </> )} </Button> @@ -96,7 +96,7 @@ return renderPopConfirm(action, index); })} {dropDownActions && dropDownActions.length && ( - <Dropdown> + <Dropdown overlayClassName="basic-tale-action-dropdown"> {{ default: dropdownDefaultSLot, overlay: () => { @@ -106,6 +106,7 @@ default: () => { return dropDownActions.map((action, index) => { const { disabled = false } = action; + action.ghost = true; return ( <Menu.Item key={`${index}`} disabled={disabled}> {() => { diff --git a/src/components/Table/src/style/index.less b/src/components/Table/src/style/index.less index e0fd7e3..0716e39 100644 --- a/src/components/Table/src/style/index.less +++ b/src/components/Table/src/style/index.less @@ -24,6 +24,11 @@ &-action { display: flex; + + button { + display: flex; + align-items: center; + } } &-toolbar { diff --git a/src/components/Table/src/types/tableAction.ts b/src/components/Table/src/types/tableAction.ts index 8a14261..5c9da2a 100644 --- a/src/components/Table/src/types/tableAction.ts +++ b/src/components/Table/src/types/tableAction.ts @@ -1,10 +1,8 @@ -export interface ActionItem { +import { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; +export interface ActionItem extends ButtonProps { onClick?: any; label: string; - disabled?: boolean; color?: 'success' | 'error' | 'warning'; - type?: string; - props?: any; icon?: string; popConfirm?: PopConfirm; } diff --git a/src/components/registerGlobComp.ts b/src/components/registerGlobComp.ts index 27bfda5..5e95823 100644 --- a/src/components/registerGlobComp.ts +++ b/src/components/registerGlobComp.ts @@ -32,6 +32,7 @@ Result, Empty, Avatar, + Menu, } from 'ant-design-vue'; import { getApp } from '/@/setup/App'; @@ -78,5 +79,6 @@ .use(Result) .use(Empty) .use(Avatar) + .use(Menu) .use(Tabs); } diff --git a/src/views/demo/table/FixedColumn.vue b/src/views/demo/table/FixedColumn.vue index bf35d71..41a142a 100644 --- a/src/views/demo/table/FixedColumn.vue +++ b/src/views/demo/table/FixedColumn.vue @@ -6,6 +6,7 @@ :actions="[ { label: '鍒犻櫎', + icon: 'ant-design:area-chart-outlined', onClick: handleDelete.bind(null, record), }, ]" -- Gitblit v1.8.0