-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
H5 Input组件如果绑定了Value,第二次更新组件,会触发死循环 #13734
Comments
ShaoGongBra
changed the title
Input组件如果绑定了Value,第二次更新组件,会触发死循环
H5 Input组件如果绑定了Value,第二次更新组件,会触发死循环
Apr 24, 2023
相同问题+1 |
回退到3.6.2问题消失 |
各种写法都没有在 3.6.5 中复现该问题,可以提供个 demo 看看 🤔️ |
@ZakaryCode 能看到问题吗 |
这个确实有问题,我考虑下怎么优化
<Input
- value={values.value1}
+ value={values?.value1 || ''}
onInput={e => setValues({ ...values, value1: e.detail.value })}
placeholder='输入1'
/>
<Button onClick={() => setShow(true)}>按钮</Button>
<View>输入1为空点击按钮会直接报错,输入1不为空,点击按钮,再输入输入1也会报错</View>
<View>当绑定的值为空的时候就会报错</View>
{
show && <Input
- value={values.test}
+ value={values?.test || ''}
onInput={e => setValues({ ...values, test: e.detail.value })}
placeholder='输入2'
/>
} |
我看还有其他人发Picker组件也有类似的问题,是不是同一个问题 |
是的 |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
相关平台
H5
小程序基础库: 最新
使用框架: React
复现步骤
比如说我刷新一下页面上的数据,然后就会触发死循环,页面白屏
期望结果
正常渲染
实际结果
延迟渲染
环境信息
The text was updated successfully, but these errors were encountered: