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

Picker 组件 h5 端异步加载 range 时不能滑动选择 #731

Closed
vimcaw opened this issue Sep 28, 2018 · 2 comments
Closed

Picker 组件 h5 端异步加载 range 时不能滑动选择 #731

vimcaw opened this issue Sep 28, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vimcaw
Copy link
Contributor

vimcaw commented Sep 28, 2018

问题描述
Picker 组件 h5 端异步加载 range 时,由于初始值传递了 null 之类的数据,导致数据更新后 Picker 不能滑动选择

复现步骤
代码有删减,只留下相关片段:

constructor(props) {
  super(props);
  
  this.state = {
    areaText: '',
    code,
    areaData: null,
    areaPickerData: null,
    addressInfo: getGlobalData('address') || {
      consignee: '',
      tel: '',
      address: ''
    }
  }
}

componentWillMount() {
  if (Taro.getEnv() === 'WEB') {
    ajax({
      name: 'getAreaData',
      success: data => {
        this.setState({
          areaPickerData: data
        })
      }
    })
  }
}

<Picker
  mode='multiSelector'
  range={areaPickerData}
  rangeKey='name'
  value={areaText}
  onChange={this.onPickerChange}
>
  {areaText.length > 0 ? area :
    <View className='placeholder'>点击选择地区</View>
  }
</Picker>

期望行为
能正常滑动选择

报错信息
无报错,行为不一致。

2018-09-28_14-59-38

系统信息

  • 操作系统: Windows 10
  • Taro 版本 v1.0.3
  • Node.js 版本 v8.11.4

补充信息

数据更新时没有正确地更新视图

@luckyadam luckyadam added the bug Something isn't working label Sep 29, 2018
@hahaxia007
Copy link

官方的样例在 也存在同样的问题,无法上下滑动

@jinjinjin0731
Copy link
Contributor

@hahaxia007 更新到最新版本即可。 官方样例版本还没有更新,晚点会更新一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants