Commit 33a335a3f52aead522b3fbee0d558e2e797580ff

Authored by 无木
1 parent 9d2231b1

fix(table): `0` is not shown in editable cell

修复可编辑单元格中未能正确显示零值的问题

fixed: #1039
CHANGELOG.zh_CN.md
1 1 ### 🐛 Bug Fixes
2 2  
3 3 - **Cropper** 修复未能及时销毁的问题
4   -- **BasicTable** 修复`CellFormat`无法使用`Map`类型数据的问题
  4 +- **BasicTable**
  5 + - 修复`CellFormat`无法使用`Map`类型数据的问题
  6 + - 修复可编辑单元格未能正确显示`0`值的问题
5 7 - **Qrcode** 修复二维码组件在创建时未能及时绘制的问题
6 8  
7 9 ## 2.7.0(2021-08-03)
... ...
src/components/Table/src/components/editable/EditableCell.vue
... ... @@ -5,8 +5,8 @@
5 5 :class="{ [`${prefixCls}__normal`]: true, 'ellipsis-cell': column.ellipsis }"
6 6 @click="handleEdit"
7 7 >
8   - <div class="cell-content" :title="column.ellipsis ? getValues || '' : ''">{{
9   - getValues || '&nbsp;'
  8 + <div class="cell-content" :title="column.ellipsis ? getValues ?? '' : ''">{{
  9 + getValues ?? '&nbsp;'
10 10 }}</div>
11 11 <FormOutlined :class="`${prefixCls}__normal-icon`" v-if="!column.editRow" />
12 12 </div>
... ... @@ -35,11 +35,10 @@
35 35 </template>
36 36 <script lang="ts">
37 37 import type { CSSProperties, PropType } from 'vue';
  38 + import { computed, defineComponent, nextTick, ref, toRaw, unref, watchEffect } from 'vue';
38 39 import type { BasicColumn } from '../../types/table';
39 40 import type { EditRecordRow } from './index';
40   -
41   - import { defineComponent, ref, unref, nextTick, computed, watchEffect, toRaw } from 'vue';
42   - import { FormOutlined, CloseOutlined, CheckOutlined } from '@ant-design/icons-vue';
  41 + import { CheckOutlined, CloseOutlined, FormOutlined } from '@ant-design/icons-vue';
43 42 import { CellComponent } from './CellComponent';
44 43  
45 44 import { useDesign } from '/@/hooks/web/useDesign';
... ... @@ -48,9 +47,9 @@
48 47 import clickOutside from '/@/directives/clickOutside';
49 48  
50 49 import { propTypes } from '/@/utils/propTypes';
51   - import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is';
  50 + import { isArray, isBoolean, isFunction, isNumber, isString } from '/@/utils/is';
52 51 import { createPlaceholderMessage } from './helper';
53   - import { set, omit } from 'lodash-es';
  52 + import { omit, set } from 'lodash-es';
54 53 import { treeToList } from '/@/utils/helper/treeHelper';
55 54  
56 55 export default defineComponent({
... ... @@ -214,8 +213,7 @@
214 213 if (isBoolean(editRule) && !currentValue && !isNumber(currentValue)) {
215 214 ruleVisible.value = true;
216 215 const component = unref(getComponent);
217   - const message = createPlaceholderMessage(component);
218   - ruleMessage.value = message;
  216 + ruleMessage.value = createPlaceholderMessage(component);
219 217 return false;
220 218 }
221 219 if (isFunction(editRule)) {
... ...