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

taro使用redux然后使用taro-ui。再加入redux。H5端会直接报错,希望解决 #2775

Closed
lixiao258 opened this issue Apr 15, 2019 · 7 comments
Assignees

Comments

@lixiao258
Copy link

lixiao258 commented Apr 15, 2019

问题描述
[问题描述:在taro 中使用了redux 以后再使用taro-ui的组件AtTabss会直接报错。去掉AtTabss就没任何问题,
或者去掉redux也没任何问题。]

复现步骤
[复现问题的步骤]

  1. 创建taro的项目默认选择安装redux。
  2. 引入taro-ui
  3. 在页面中同时使用ui组件AtTabs和redux会报错

[或者可以直接贴源代码,能贴文字就不要截图]

// 这里可以贴代码
import Taro from '@tarojs/taro'
import { View,Button } from '@tarojs/components'
import { connect } from '@tarojs/redux'
import { add, minus, asyncAdd } from '../../actions/counter'
import { AtTabs, AtTabsPane } from 'taro-ui'

@connect(({ counter }) => ({
  counter
}), (dispatch) => ({
  add () {
    dispatch(add())
  },
  dec () {
    dispatch(minus())
  },
  asyncAdd () {
    dispatch(asyncAdd())
  }
}))

export default class Index extends Taro.Component {
  handleClick (value) {
    this.setState({
      current: value
    })
  }

  render () {

    return (
      <View>

        <AtTabs
          current={this.state.current}
          scroll
          tabList={[
            { title: '标签页1' },
            { title: '标签页2' },
            { title: '标签页3' },
            { title: '标签页4' },
            { title: '标签页5' },
            { title: '标签页6' }
          ]}
          onClick={this.handleClick.bind(this)}>
          <AtTabsPane current={this.state.current} index={0}>
            <View style='font-size:18px;text-align:center;height:100px;'>标签页一的内容</View>
          </AtTabsPane>
          <AtTabsPane current={this.state.current} index={1}>
            <View style='font-size:18px;text-align:center;height:100px;'>标签页二的内容</View>
          </AtTabsPane>
          <AtTabsPane current={this.state.current} index={2}>
            <View style='font-size:18px;text-align:center;height:100px;'>标签页三的内容</View>
          </AtTabsPane>
          <AtTabsPane current={this.state.current} index={3}>
            <View style='font-size:18px;text-align:center;height:100px;'>标签页四的内容</View>
          </AtTabsPane>
          <AtTabsPane current={this.state.current} index={4}>
            <View style='font-size:18px;text-align:center;height:100px;'>标签页五的内容</View>
          </AtTabsPane>
          <AtTabsPane current={this.state.current} index={5}>
            <View style='font-size:18px;text-align:center;height:100px;'>标签页六的内容</View>
          </AtTabsPane>
        </AtTabs>
        <View className='todo'>
          <Button className='add_btn' onClick={this.props.add}>+</Button>
          <Button className='dec_btn' onClick={this.props.dec}>-</Button>
          <Button className='dec_btn' onClick={this.props.asyncAdd}>async</Button>
          <View>{this.props.counter.num}</View>
        </View>
      </View>


    )
  }
}

期望行为
[希望尽快解决这个bug]

报错信息

[
image
]

系统信息

Taro v1.2 及以上版本已添加 taro info 命令,方便大家查看系统及依赖信息,运行该命令后将结果贴下面即可。

  • 操作系统: [e.g. Windows 10]
  • Taro 版本 [e.g. v.0.0.64]
  • Node.js 版本 [e.g. v9.0.0]
  • 报错平台 [h5, weapp]

补充信息
[可选]
[根据你的调查研究,出现这个问题的原因可能在哪里?]

@taro-bot
Copy link

taro-bot bot commented Apr 15, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@lixiao258 lixiao258 changed the title taro使用redux然后使用taro-ui。再加入redux taro使用redux然后使用taro-ui。再加入redux。H5端会直接报错,希望解决 Apr 15, 2019
@Littly
Copy link
Contributor

Littly commented Apr 15, 2019

具体一点 什么报错?

@lixiao258
Copy link
Author

具体一点 什么报错?
在taro 中使用了redux 以后再使用taro-ui的组件AtTabss会直接报错。去掉AtTabss就没任何问题,
或者去掉redux也没任何问题。
报错:Uncaught (in promise) TypeError: Cannot read property 'childNodes' of undefined
at AtTabs._this.updateState (index.js?ff21:47)
at AtTabs.componentWillReceiveProps (index.js?ff21:118)
at eval (index.js?1e21:1595)
at errorCatcher (index.js?1e21:1481)
at reRenderComponent (index.js?1e21:1594)
at ComponentWrapper.update (index.js?1e21:1873)
at patch (index.js?1e21:918)
at updateComponent (index.js?1e21:1647)
at rerender (index.js?1e21:1698)

@lixiao258
Copy link
Author

具体一点什么报错?
我不小心点了关闭了 但是问题没解决了。忘处理下

@lixiao258 lixiao258 reopened this Apr 15, 2019
@lixiao258
Copy link
Author

myApp.zip这是出错的代码

@Littly Littly added the H5 label Apr 16, 2019
@taro-bot
Copy link

taro-bot bot commented Apr 16, 2019

CC @Littly

@lixiao258
Copy link
Author

tarojs 1.2.16有这个问题新的1.2.26已经没这个问题了

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

2 participants