Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditableCell组件值为数字0时不展示 #6851

Closed
q060831 opened this issue Jul 6, 2024 · 7 comments
Closed

EditableCell组件值为数字0时不展示 #6851

q060831 opened this issue Jul 6, 2024 · 7 comments

Comments

@q060831
Copy link

q060831 commented Jul 6, 2024

版本号:3.7.0

问题描[述:

  <div v-show="!isEdit" :class="{ [`${prefixCls}__normal`]: true, 'ellipsis-cell': column.ellipsis }" @click="handleEdit">
      <div class="cell-content" :title="column.ellipsis ? getValues ?? '' : ''">
        <!-- 这种写法,getValues的值为0时,判断是为false的 -->
        {{ getValues ? getValues : '&nbsp;' }}
      </div>
      <FormOutlined :class="`${prefixCls}__normal-icon`" v-if="!column.editRow" />
    </div>
@zhangdaiscott
Copy link
Member

@q060831
Copy link
Author

q060831 commented Jul 6, 2024

当可编辑单元格为数字类型时,如果值为0,非编辑状态下是一片空白

@zhangdaiscott
Copy link
Member

这个问题以前提过修复了,你确定你是最新版?

@q060831
Copy link
Author

q060831 commented Jul 9, 2024

确定是最新版
截图上传不了,源码中一眼就可以看的出来,元素的title有用??判断没问题,但是显示却用?就变成了0不显示了,但是鼠标悬浮的title却能正常显示

@liaozhiyang
Copy link
Contributor

已修复,下一版本发布。

@q060831
Copy link
Author

q060831 commented Jul 24, 2024

解决了0不展示问题,但是长度为0的字符串无法编辑的问题又出来的。
建议改成这样

<div v-show="!isEdit" :class="{ [`${prefixCls}__normal`]: true, 'ellipsis-cell': column.ellipsis }" @click="handleEdit">
      <div class="cell-content" :title="column.ellipsis ? getValues ?? '' : ''">
        {{ getValues || getValues === 0 ? getValues : '&nbsp;' }}
      </div>
      <FormOutlined :class="`${prefixCls}__normal-icon`" v-if="!column.editRow" />
    </div>

@liaozhiyang
Copy link
Contributor

解决了0不展示问题,但是长度为0的字符串无法编辑的问题又出来的。 建议改成这样

<div v-show="!isEdit" :class="{ [`${prefixCls}__normal`]: true, 'ellipsis-cell': column.ellipsis }" @click="handleEdit">
      <div class="cell-content" :title="column.ellipsis ? getValues ?? '' : ''">
        {{ getValues || getValues === 0 ? getValues : '&nbsp;' }}
      </div>
      <FormOutlined :class="`${prefixCls}__normal-icon`" v-if="!column.editRow" />
    </div>

已修复,下一版本发布。

按如下更改应该更妥当:
1.字符串可能有多个空格存在的情况
2.布尔false也能显示在界面

image
{{ typeof getValues === 'string' && getValues.length === 0 ? '&nbsp;' : getValues ?? '&nbsp;' }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants