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

[InputNumber] 受控模式下,默认第一次的 value 不会被 formatter 转换 #2548

Open
1 task done
DaiQiangReal opened this issue Oct 28, 2024 · 0 comments
Open
1 task done

Comments

@DaiQiangReal
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Which Component

InputNumber

Semi Version

No response

Current Behavior

实际显示100,实际显示1

Expected Behavior

No response

Steps To Reproduce

No response

ReproducibleCode

()=>{
    const [a,setA] = useState(1);
    return <InputNumber
                    value={a} //预期展示100,实际展示1
                    field='percentage'
                    label='percentage'
                    suffix="%"
                    step={0.1} 
                    min={0}
                    max={1}
                    onChange={setA}
                    formatter={value => `${Number(value) * 100}`}
                    parser={value => `${Number(value) / 100}`}
                    style={{ width: 200 }} />

}

Environment

- OS:
- browser:

Anything else?

No response

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