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

<Input>组件onInput时,return 一个字符串,input框的值未发生变化 #8144

Open
Arima666 opened this issue Nov 27, 2020 · 4 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@Arima666
Copy link

相关平台

微信小程序

小程序基础库: 2.8.3
使用框架: React

复现步骤

import React, { FC, useState } from 'react'
import { View, Input } from '@tarojs/components';

const a: FC = () => {
    const [inputVal, setInputVal] = useState<string>()
    
    const onInput = (e) => {
        const val = e.detail.value   '1'
        setInputVal(val);
        return val
    }

    return (
        <View>
            <Input onInput={onInput} />
        </View>
    );
}

期望结果

期望结果自动加上字符串1

实际结果

输入框的值没有加上字符串1

环境信息

Taro CLI 3.0.17 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.15.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.10 - C:\Program Files\nodejs\yarn.CMD
      npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Nov 27, 2020
@qiyulaoshi
Copy link

请问这个问题怎么解决呢

@moon1995
Copy link

同问,这个问题解决了嘛

@qiyulaoshi
Copy link

同问,这个问题解决了嘛

我是需要对input值进行限制,使用的useEffect进行监听后 再重新赋值,这样实现了我得需求

@za1189zx
Copy link

2023年了,这个问题还没有解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

4 participants