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 convert转换成taro代码,再编译成支付宝小程序,项目运行报错 #8528

Closed
joaquin-qin opened this issue Jan 14, 2021 · 1 comment
Labels
F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-3 Version - 3.x

Comments

@joaquin-qin
Copy link

相关平台

支付宝小程序

复现仓库

https://github.com/joaquin-qin/taro-convert-test
小程序基础库: 1.24.3
使用框架: React

复现步骤

1.将原生微信小程序代码转换为taro代码

$ taro convert

2.编译成支付宝小程序

$ cd taroConvert

$ npm install

$ npm run dev:alipay

3.使用支付宝小程序开发工具打开项目

期望结果

代码正常运行

实际结果

代码无法运行代码,报错。

  1. getApp()返回的值没有globalData和自定义的函数
  2. App中的onLaunch,onShow等方法没执行

环境信息

taro v3.1.0-beta.4

  Taro CLI 3.1.0-beta.4 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.15.4 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.14.11 - C:\software\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-3 Version - 3.x labels Jan 14, 2021
@Chen-jj Chen-jj added this to the 3.1.0 milestone Jan 15, 2021
@Chen-jj
Copy link
Contributor

Chen-jj commented Jan 26, 2021

@joaquin-qin 把 data.message 注释掉,或给个空字符串,页面 onLoad 再设置为 app.globalData.message

@withWeapp({
  data: {
    motto: 'Hello World',
    // message: app.globalData.message
  }
})

这是因为支付宝机制有点不一样,这时还拿不到 app 上最新设置的属性:

image

@Chen-jj Chen-jj closed this as completed Jan 26, 2021
@Chen-jj Chen-jj removed this from the 3.1.0 milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants