taro icon indicating copy to clipboard operation
taro copied to clipboard

iview-weapp 有个key的选项,会编译为wx:key,如何让它不编译

Open chenli90s opened this issue 8 years ago • 7 comments

<i-tabs current={current} color='#f759ab' onChange={this.handleChange}>
            <i-tab key='now' title='接单中'></i-tab>
            <i-tab key='in' title='上门中'></i-tab>
            <i-tab key='succ' title='已完成'></i-tab>
 </i-tabs>

chenli90s avatar Aug 25 '18 18:08 chenli90s

chenli90s avatar Aug 25 '18 18:08 chenli90s

fix

chenli90s avatar Aug 25 '18 18:08 chenli90s

换taro-ui吧

ruixiu avatar Aug 28 '18 06:08 ruixiu

<wux-tabs className='tabs' auto current={current} onChange={this.onChange.bind(this)}>
          {tabItems.map((item, index) => {
            return <wux-tab key={item.id} tab_key={item.id} title={item.title} />
          })}
</wux-tabs>
<wux-refresher id='wux-refresher' onRefresh={this.onRefresh.bind(this)} className='container'>

这看起来不是很好的解决方案, 我的第三方组件不能正常运行 比如className key onChange属性都直接跳过了, 不能生成onChange事件。taro-ui的话 没有下拉刷新 小程序自带的没有动画

Qiu800820 avatar Sep 01 '18 06:09 Qiu800820

最新 beta 版本应该已经不会编译成 wx:key 了

luckyadam avatar Sep 02 '18 03:09 luckyadam

@luckyadam 确实最新版已经忽略了第三方组件的key及事件的处理, 但却造成所有的第三方组件不能响应事件了,比如我上面的onChange事件 就算我修改成bindonchang $$event中也没有生成onChange 是为了平台统一么,另外0b4d7ce的修改导致className -> class 只作用于默认组件了

Qiu800820 avatar Sep 02 '18 15:09 Qiu800820

@Qiu800820 https://github.com/NervJS/taro/commit/4b7249672cc88298e8ee79c3a9d1be7f59eca555 的确有问题,应该改成只作用于 key。修复在 https://github.com/NervJS/taro/commit/2920f335c4ee8622237a15d75bc98ce47744b1e0

https://github.com/NervJS/taro/commit/0b4d7ce63f68297f70db179e95162bf39737f4b0 应该是对的,自定义组件的 props 就应该是你写什么就是什么

yuche avatar Sep 02 '18 15:09 yuche