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

taro3 1、使用HOC 分享报错 TypeError: Cannot read property 'call' of undefined 2、使用preval 报错 preval is not defined #8370

Closed
ywanhzy opened this issue Dec 25, 2020 · 3 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@ywanhzy
Copy link

ywanhzy commented Dec 25, 2020

相关平台

微信小程序

复现仓库

https://github.com/ywanhzy/Taro3-mobx-test
小程序基础库: 2.14.0
使用框架: React

复现步骤

1.taro3 使用HOC 分享报错 TypeError: Cannot read property 'call' of undefined
2.app.config.ts 中使用preval 报错 preval is not defined
这两个插件都装了 "@babel/register": "7.12.10", "babel-plugin-preval": "^5.0.0", bable.config.js里也加了plugins: ["preval"]

期望结果

正常分享

实际结果

TypeError: Cannot read property 'call' of undefined

环境信息

Taro CLI 3.0.21 environment info:
    System:
      OS: macOS 10.15
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.13.0 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.21 => 3.0.17 
      @tarojs/mini-runner: 3.0.21 => 3.0.17 
      @tarojs/react: 3.0.21 => 3.0.17 
      @tarojs/runtime: 3.0.21 => 3.0.17 
      @tarojs/taro: 3.0.21 => 3.0.17 
      @tarojs/webpack-runner: 3.0.21 => 3.0.17 
      babel-preset-taro: 3.0.21 => 3.0.17 
      eslint-config-taro: 3.0.21 => 3.0.17 
      react: ^16.10.0 => 16.14.0 
    npmGlobalPackages:
      typescript: 4.0.3
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Dec 25, 2020
@ywanhzy ywanhzy changed the title taro3 使用HOC 分享报错 TypeError: Cannot read property 'call' of undefined taro3 1、使用HOC 分享报错 TypeError: Cannot read property 'call' of undefined 2、使用preval 报错 preval is not defined Dec 25, 2020
@luckyadam
Copy link
Member

1、第一个问题,在页面配置里加个配置 #7232 (comment)
2、第二个问题,不需要再使用 preval 了,请参见 https://docs.taro.zone/docs/envs#appjs-%E4%B8%AD%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84-pages

@ywanhzy
Copy link
Author

ywanhzy commented Dec 29, 2020

1、第一个问题,在页面配置里加个配置 #7232 (comment)
2、第二个问题,不需要再使用 preval 了,请参见 https://docs.taro.zone/docs/envs#appjs-%E4%B8%AD%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84-pages

@luckyadam 谢谢 问题已解决 问题一是把高阶组件的返回值 改为return 就好了

@ywanhzy ywanhzy closed this as completed Dec 29, 2020
@voyageh
Copy link

voyageh commented May 13, 2021

1、第一个问题,在页面配置里加个配置 #7232 (comment)
2、第二个问题,不需要再使用 preval 了,请参见 https://docs.taro.zone/docs/envs#appjs-%E4%B8%AD%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84-pages

@luckyadam 谢谢 问题已解决 问题一是把高阶组件的返回值 改为return 就好了

@ywanhzy preval可以用了?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

3 participants