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

omi-mp小程序转H5微信支付的问题 #211

Open
baixiaohan opened this issue Dec 7, 2018 · 6 comments
Open

omi-mp小程序转H5微信支付的问题 #211

baixiaohan opened this issue Dec 7, 2018 · 6 comments

Comments

@baixiaohan
Copy link

请问小程序里集成了微信支付,转h5的话是否只能把h5项目里的支付模块重新实现,然后分别维护小程序和h5的代码?

@baixiaohan
Copy link
Author

另外就是如果要分别维护的话,对于转换后的src目录里的代码,脱离src-mp中的小程序,单独开发并运行要怎么处理?
目前在修改了src目录文件后,只要重新运行start就会重新编译小程序覆盖src。

@dntzhang
Copy link
Collaborator

dntzhang commented Dec 7, 2018

确实需要分别开发维护,目前来看,开发维护的目录都应该放在 src-mp 里,所以就不用担心覆盖的问题。

@baixiaohan
Copy link
Author

确实需要分别开发维护,目前来看,开发维护的目录都应该放在 src-mp 里,所以就不用担心覆盖的问题。

src-mp里放的是小程序的代码,怎么在小程序的代码里写h5页面的微信支付呢?小程序用的是内置api,h5的话只能用web的api,编译之前没有web的环境啊。

@dntzhang
Copy link
Collaborator

dntzhang commented Dec 7, 2018

src-mp里也可以放兼容性代码啊,比如:

if(typeof window !== 'undefined'){
//浏览器
}else{
//小程序
}
@baixiaohan
Copy link
Author

我想的是通过配置把不同环境的功能代码进行隔离的办法。
混在一起的写法,小程序在提交上线审核的时候,如果代码里有大量和微信无关的h5功能代码(甚至是支付宝付款功能),对审核上线可能产生负面影响吗?h5版为了推广,不会只在微信公众号里,也会有其他渠道。

@dntzhang
Copy link
Collaborator

dntzhang commented Dec 7, 2018

if(typeof window !== 'undefined'){
//浏览器
loadScript('./xxx.js')
}else{
//小程序
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants