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

🐛[BUG] ProFormDigit stringMode 输入长数字 readonly true 时展示的数字被裁减 #8553

Closed
wellhashcq opened this issue Jul 9, 2024 · 0 comments

Comments

@wellhashcq
Copy link

wellhashcq commented Jul 9, 2024

🐛 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;

© 版本信息

ProComponents 版本: [5.17.3]
浏览器环境 版本 126.0.6478.127(正式版本) (arm64)
开发环境 [mac OS]

🚑 其他信息

@wellhashcq wellhashcq changed the title 🐛[BUG]ant desgin ProFormDigit stringMode 输入长数字 readonly true 时展示的数字被裁减 🐛[BUG] ProFormDigit stringMode 输入长数字 readonly true 时展示的数字被裁减 Jul 9, 2024
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

1 participant