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 出现的问题 #2234

Closed
xllily opened this issue Feb 21, 2019 · 1 comment
Closed

微信小程序 转 taro 出现的问题 #2234

xllily opened this issue Feb 21, 2019 · 1 comment
Assignees

Comments

@xllily
Copy link

xllily commented Feb 21, 2019

微信小程序原生代码未自动转换
在 step by step 地践行将现有原生开发的微信小程序转换成 taro 的过程中,
在 小程序 成功转换编译成 taro 之后,(保证过程中未出现任何报错信息),
依然出现了未将部分原生代码 转换成符合 taro 运行的代码

复现步骤

  1. 准备一个原生编写的微信小程序项目
  2. 小程序运行正确的原生代码片段:
//app.js
App({
    ...
	onLaunch: function(option) {
	   console.log(option.query);
	},
	...
});

// pages/xxx/xxx.js
Page({
	...
	onLoad: function(option) {
	   const {pram1,pram2} = option;
	   console.log(option.query,parm1,parm2);
	}
	...
});
  1. convert and build 成 h5 之后,发现的未转换的,导致在浏览器端运行报错的代码片段:
//app.js
class App extends Taro.Component {
    ...
	componentWillMount(option) {
	   console.log(option.query);
	},
	...
}

// pages/xxx/xxx.js
class _C extends Taro.Component {
	...
	componentWillMount(option) {
	   const {pram1,pram2} = option;
	   console.log(option.query,parm1,parm2);
	}
	...
}

期望行为
希望这些不符合 taro 的小程序原生代码,由 taro 自动转换。
例如本次case中,可以自动转成符合 taro 的 this.$router.parmas

报错信息

“Uncaught TypeError: Cannot read property 'query' of undefined”

系统信息
👽 Taro v1.2.13

Taro CLI 1.2.13 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.12.0
Yarn: 1.12.3
npm: 6.4.1

@taro-bot
Copy link

taro-bot bot commented Feb 21, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@xllily xllily changed the title Bug report 微信小程序 转 taro 出现的问题 Feb 21, 2019
@yuche yuche added the taroize label Feb 21, 2019
@yuche yuche self-assigned this Feb 21, 2019
@yuche yuche closed this as completed in 43eb400 Mar 15, 2019
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