导航

    Taro 社区

    Taro

    • 注册
    • 登录
    • 搜索
    • 版块
    • 最新
    • 话题
    • 热门
    • 群组
    1. 主页
    2. lzs2000131
    L
    • 资料
    • 关注
    • 粉丝
    • 主题
    • 帖子
    • 最佳
    • 群组

    lzs2000131

    @lzs2000131

    0
    声望
    11
    帖子
    1333
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    lzs2000131 关注

    lzs2000131 发布的帖子

    • RE: Taro1.3.29项目,升级到2.0.0-beta.8后,出现很多错误

      哦,我知道我的问题了,现在必须是一个css对应一个组件,我有一些子组件共享css的就不正常了

      发布在 Taro
      L
      lzs2000131
    • RE: Taro1.3.29项目,升级到2.0.0-beta.8后,出现很多错误

      一样的问题,而且不是所有的组件都不独立打包css,只有部分组件出现这样的问题

      发布在 Taro
      L
      lzs2000131
    • RE: 使用useEffect,组件获取不到props,三楼已添加demo

      @keep2zero 没有构造函数,所有代码均是hooks函数式编程,可以看三楼demo

      发布在 字节跳动小程序
      L
      lzs2000131
    • RE: 使用useEffect,组件获取不到props,三楼已添加demo

      升级到1.3.27,nextTick is not defined是不报错了,但是获取不到props的问题依然没解决。。。。

      发布在 字节跳动小程序
      L
      lzs2000131
    • RE: taro怎么做国际化

      @jd_61118b9c9b0c0

      import zhcn from './zh-CN/translation'
      import enus from './en-US/translation'
      import jajp from './ja-JP/translation'
      import zhtw from './zh-TW/translation'
      import systemUtil from '../utils/system-util'
      
      function getI18n() {
        let i18n: any
        let lang = systemUtil.getLanguage()
        switch(lang) {
          case 'zh_CN':
            i18n = zhcn
            break
          case 'en_US':
            i18n = enus
            break
          case 'ja_JP':
            i18n = jajp
            break
          case 'zh_TW':
            i18n = zhtw
            break
          default:
            i18n = zhcn
        }
        return i18n
      }
      
      export default getI18n
      

      我是这么做的,在systemUtil里面内存+持久化当前的语言,在每个页面引入运行这个函数

      发布在 Taro
      L
      lzs2000131
    • RE: 使用useEffect,组件获取不到props,三楼已添加demo

      现在升级到1.3.26了,升级之后同样的代码依然不行,不过明确的报错了

      thirdScriptErrornextTick is not defined;at pages/index/index onReady function;ReferenceError: nextTick is not defined

      👽 Taro v1.3.26
      
      
        Taro CLI 1.3.26 environment info:
          System:
            OS: macOS 10.14.4
            Shell: 5.3 - /bin/zsh
          Binaries:
            Node: 12.13.0 - /usr/local/bin/node
            Yarn: 1.16.0 - /usr/local/bin/yarn
            npm: 6.12.0 - /usr/local/bin/npm
          npmGlobalPackages:
            typescript: 3.6.4
      
      发布在 字节跳动小程序
      L
      lzs2000131
    • RE: 【求助】taro 自定义组件使用map循环,出现从父组件传递的props数据不渲染

      @Cjj 我也遇到这个问题 https://taro-club.jd.com/topic/870/使用useeffect-组件获取不到props-三楼已添加demo

      发布在 提 Bug
      L
      lzs2000131
    • RE: Taro支持钉钉小程序么?

      支持,就是支付宝小程序,把钉钉的开发工具下载下来就知道了

      发布在 Taro
      L
      lzs2000131
    • RE: 使用useEffect,组件获取不到props,三楼已添加demo

      重现代码
      index.tsx

      import Taro, { useState, useEffect } from '@tarojs/taro'
      import { View } from '@tarojs/components'
      import BottomTabbar from './bottom-tabbar'
      
      export default function Index() {
        const [title, setTitle] = useState('默认')
        const [value, setValue] = useState('value1')
      
        const list = [
          {
            text: '新建',
            type: 'new'
          }
        ]
      
        useEffect(() => {
          setTitle('更改')
        }, [])
      
        useEffect(() => {
          setValue('value2')
        }, [title])
      
        return (
          <View>
            <View>{value}</View>
            <View>
              {list.map(item => {
                return <BottomTabbar key={item.type} itemData={item} />
              })}
            </View>
          </View>
        )
      }
      
      

      bottom-tabbar.tsx

      import Taro, { useContext, useState, useRouter } from '@tarojs/taro'
      import { View } from '@tarojs/components'
      
      export default function BottomTabbar(props) {
      
        console.log(props)
        const { itemData: item } = props
      
        return (
          <View>
            <View>{item.text}</View>
          </View>
        )
      }
      
      

      BottomTabbar是渲染不出来的,注释掉两个useEffect就能出来

      发布在 字节跳动小程序
      L
      lzs2000131