Dolov.github.io

前言

前段时间公司决定开发移动端项目,需要适配小程序端、h5 端。以后也不排除有向其他端扩展的可能性。对比了一些相关的跨端开发框架,如 uni-app、mpvue、chameleon、Taro 等。最后出于以下考虑采用了 Taro。

踩过的坑

在使用 Taro 开发的过程中遇到的很多的问题,这是使用任何框架都无法避免的情况。这里把遇到的问题简单的记录一下,避免重复踩坑。(h5 和 weapp 端)


  // wrong

  <InstanceTest instance={this} />

  // fix

  <InstanceTest instance={() => this} />

  // wrong

  const Error = <View>error</View>
  
  render() {
    const { name, id } = this.props.params || {}
  }