Commit 73654b7862c59d623d6d5dc7dcf6ff2704564d9a

Authored by 无木
1 parent 5fab267a

fix(popconfirm-button): remove button excess `title`

移除PopconfirmButton组件多余的title;修改TableAction的tooltip默认位置
src/components/Button/src/PopConfirmButton.vue
... ... @@ -41,7 +41,7 @@
41 41  
42 42 return () => {
43 43 const bindValues = omit(unref(getBindValues), 'icon');
44   - const Button = h(BasicButton, bindValues, extendSlots(slots));
  44 + const Button = h(BasicButton, omit(bindValues, 'title'), extendSlots(slots));
45 45  
46 46 // If it is not enabled, it is a normal button
47 47 if (!props.enable) {
... ...
src/components/Table/src/components/TableAction.vue
... ... @@ -3,10 +3,8 @@
3 3 <template v-for="(action, index) in getActions" :key="`${index}-${action.label}`">
4 4 <Tooltip v-bind="getTooltip(action.tooltip)">
5 5 <PopConfirmButton v-bind="action">
6   - <Tooltip v-bind="getTooltip(action.tooltip)">
7   - <Icon :icon="action.icon" class="mr-1" v-if="action.icon" />
8   - {{ action.label }}
9   - </Tooltip>
  6 + <Icon :icon="action.icon" class="mr-1" v-if="action.icon" />
  7 + {{ action.label }}
10 8 </PopConfirmButton>
11 9 </Tooltip>
12 10 <Divider
... ... @@ -35,7 +33,7 @@
35 33 <script lang="ts">
36 34 import { defineComponent, PropType, computed, toRaw } from 'vue';
37 35 import { MoreOutlined } from '@ant-design/icons-vue';
38   - import { Divider, Tooltip } from 'ant-design-vue';
  36 + import { Divider, Tooltip, TooltipProps } from 'ant-design-vue';
39 37 import Icon from '/@/components/Icon/index';
40 38 import { ActionItem, TableActionType } from '/@/components/Table';
41 39 import { PopConfirmButton } from '/@/components/Button';
... ... @@ -129,11 +127,11 @@
129 127 });
130 128  
131 129 const getTooltip = computed(() => {
132   - return (data) => {
  130 + return (data: string | TooltipProps): TooltipProps => {
133 131 if (isString(data)) {
134   - return { title: data };
  132 + return { title: data, placement: 'bottom' };
135 133 } else {
136   - return data;
  134 + return Object.assign({ placement: 'bottom' }, data);
137 135 }
138 136 };
139 137 });
... ...