Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

TS taro 的小程序原生组件Input 的type支持 number 但是 value 类型却只有string #11519

Closed
XERA-2011 opened this issue Mar 27, 2022 · 2 comments
Assignees
Labels
A-typings Area - TypeScript Typings 相关 F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x wonfix 不会修复(这可能并非是一个问题)

Comments

@XERA-2011
Copy link

相关平台

微信小程序

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

复现步骤

使用TS <Input type='number' value={value} />的value给number类型,会报红

期望结果

希望value有除了string以外的类型支持

实际结果

只有sting

环境信息

👽 Taro v3.4.1


  Taro CLI 3.4.1 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.17 - C:\Users\XERA\AppData\Roaming\npm\yarn.CMD
      npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD

补充信息

主要是看到TS报红,可能我的用法错了或者有其他解决方法...

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Mar 27, 2022
@github-actions
Copy link
Contributor

@ZakaryCode
Copy link
Contributor

按照 wx 官方的定义,Input.value 类型只支持 string,如果需要填入其他类型需要完成类型转换

@ZakaryCode ZakaryCode added A-typings Area - TypeScript Typings 相关 wonfix 不会修复(这可能并非是一个问题) labels Mar 28, 2022
@NervJS NervJS locked and limited conversation to collaborators Mar 28, 2022
@ZakaryCode ZakaryCode converted this issue into discussion #11520 Mar 28, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
A-typings Area - TypeScript Typings 相关 F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x wonfix 不会修复(这可能并非是一个问题)
Projects
None yet
Development

No branches or pull requests

2 participants