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

Taro1.2.4版H5端Input组件问题 #1819

Closed
schinvendy opened this issue Jan 5, 2019 · 3 comments
Closed

Taro1.2.4版H5端Input组件问题 #1819

schinvendy opened this issue Jan 5, 2019 · 3 comments
Assignees

Comments

@schinvendy
Copy link

问题描述
在Taro 1.2.3版本下没有出现,升级1.2.4后,Input组件类型为number或者digit时输入就会出现报错。

Uncaught DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement': The input element's type ('number') does not support selection.

复现步骤

测试Demo

import Taro, { Component } from '@tarojs/taro';
import { View, Input, Text } from '@tarojs/components';
import './index.scss';

export default class Index extends Component {
  config = {
    navigationBarTitleText: '首页'
  };

  state = {
    text: 'text',
    number: 1,
    digit: 2.2
  };

  componentDidMount() {}

  onInput(type, e) {
    console.log('[type]', type, ', [e detail value]', e.detail.value);
    this.setState({
      [type]: e.detail.value
    });
  }

  render() {
    return (
      <View className="index">
        <Text>获取输入值:{this.state.text}</Text>
        <Input type="text" placeholder="输入同步到 view 中" onInput={this.onInput.bind(this, 'text')} />
        <Text>数字输入的 input:{this.state.number}</Text>
        <Input type="number" placeholder="这是一个数字输入框" onInput={this.onInput.bind(this, 'number')} />
        <Text>带小数点的 input:{this.state.digit}</Text>
        <Input type="digit" placeholder="带小数点的数字键盘" onInput={this.onInput.bind(this, 'digit')} />
      </View>
    );
  }
}

报错信息

Taro v1.2.3 版本下:
1 2 3ver

Taro v1.2.4 版本下:
1 2 4ver

系统信息
出现报错的环境:

👽 Taro v1.2.4
Taro CLI 1.2.4 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.13.0 - D:\nodejs\node.EXE
npm: 6.4.1 - D:\nodejs\npm.CMD

@taro-bot
Copy link

taro-bot bot commented Jan 5, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@taro-bot
Copy link

taro-bot bot commented Jan 5, 2019

CC @jinjinjin0731

@jinjinjin0731
Copy link
Contributor

已修复

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

3 participants