We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
微信小程序
小程序基础库: 2.26.0 使用框架: React
const MyInput = () => { const [num, setNum] = useState(99); return ( <Input onInput={(e) => { if (!e.detail.value) { setNum(1); } else { setNum(e.detail.value); } }} value={num} /> ); }; class MyInput2 extends Component { constructor(props) { super(props); this.state = { num: 88, }; } render() { return ( <Input onInput={(e) => { if (!e.detail.value) { this.setState({ num: 1, }); } else { this.setState({ num: e.detail.value }); } }} value={this.state.num} /> ); } }
在hooks组件中 受控的值会刷新input value
在hooks组件中 当删除为空时,第一次会刷新为1,但是第二次会导致input框直接没值
Taro CLI 3.5.7 environment info: System: OS: macOS 12.6 Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node Yarn: 1.18.0 - ~/.nvm/versions/node/v14.19.1/bin/yarn npm: 8.19.1 - ~/.nvm/versions/node/v14.19.1/bin/npm npmPackages: @tarojs/components: 3.5.6 => 3.5.6 @tarojs/plugin-framework-react: 3.5.6 => 3.5.6 @tarojs/react: 3.5.6 => 3.5.6 @tarojs/runtime: 3.5.6 => 3.5.6 @tarojs/taro: 3.5.6 => 3.5.6 @tarojs/webpack5-runner: ^3.5.6 => 3.5.6 babel-preset-taro: 3.5.6 => 3.5.6 eslint-config-taro: 3.5.6 => 3.5.6 react: ^18.2.0 => 18.2.0
如代码两个组件 执行删除操作 hooks 组件表现 99 > 9 > 1 > 空 class 组件表现 88 > 8 >. 1 > ....> 1
The text was updated successfully, but these errors were encountered:
感谢指出,这确实是个bug,会尽快安排修复
Sorry, something went wrong.
AdvancedCat
Successfully merging a pull request may close this issue.
相关平台
微信小程序
小程序基础库: 2.26.0
使用框架: React
复现步骤
期望结果
在hooks组件中 受控的值会刷新input value
实际结果
在hooks组件中 当删除为空时,第一次会刷新为1,但是第二次会导致input框直接没值
环境信息
补充信息
如代码两个组件 执行删除操作
hooks 组件表现 99 > 9 > 1 > 空
class 组件表现 88 > 8 >. 1 > ....> 1
The text was updated successfully, but these errors were encountered: