ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🐛[BUG] #8552

Closed wellhashcq closed 3 months ago

wellhashcq commented 3 months ago

🐛 bug 描述

ant desgin ProFormDigit 使用string Mode 。输入一个长数字,例如。9999999999.123456789 当表单设置readonly 为true的时候。 数字会被裁减。

📷 复现步骤

用下面的代码 输入数字。然后点击按钮改变只读

🏞 期望结果

readonly和输入的数字保持一致。 因为是stringMode. 本就是为了解决长数字。 自动裁剪会破坏功能。

💻 复现代码

import { ProForm, ProFormDigit, ProFormGroup, } from '@ant-design/pro-components'; import { Switch } from 'antd'; import { useState } from 'react';

export const waitTime = (time: number = 100) => { return new Promise((resolve) => { setTimeout(() => { resolve(true); }, time); }); };

const Demo = () => { const [readonly, setReadonly] = useState(false); return ( <div style={{ padding: 24, }}

<Switch style={{ marginBlockEnd: 16, }} checked={readonly} checkedChildren="编辑" unCheckedChildren="只读" onChange={setReadonly} /> <ProForm readonly={readonly} name="validate_other"

    <ProFormGroup label="数字类">
      <ProFormDigit
        label="InputNumber"
        name="input-number"
        width="sm"
        fieldProps={
          {
            precision:8,
            stringMode:true
          }
        }
      />
    </ProFormGroup>
  </ProForm>
</div>

); };

export default Demo;

© 版本信息

🚑 其他信息

image image

github-actions[bot] commented 3 months ago

当前 Issue 未检测到标题,请规范填写,谢谢!

The title of the current issue is not detected, please fill in according to the specifications, thank you!