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 Next]为什么runtime不对微信小程序的window对象添加Date、setTimeout等 #6451

Closed
cuikangyi opened this issue May 25, 2020 · 2 comments
Assignees

Comments

@cuikangyi
Copy link
Contributor

问题描述

这里为什么没有微信小程序

if (process.env.TARO_ENV === 'tt' || process.env.TARO_ENV === 'swan' || process.env.TARO_ENV === 'jd') {
(window as any).requestAnimationFrame = raf;
(window as any).cancelAnimationFrame = caf;
(window as any).Date = Date;
(window as any).setTimeout = setTimeout
}

复现步骤

/**
 * 这段注释后可以贴代码
 * 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间
 * 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】
 * 
 * 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5
 */

期望行为

报错信息

系统信息

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@yuche
Copy link
Contributor

yuche commented May 26, 2020

因为不加这些的小程序就跑不了,支付宝和微信不加也能跑

@cuikangyi
Copy link
Contributor Author

@yuche 哦哦
给微信小程序加一下吧,因为在使用微信PC端打开小程序时报错,加上之后就不会了,下图时直接使用Taro init创建的项目,使用ts+redux模板时出现的错误,如果上述代码不忽略小程序就可以正常运行
这个错误上周五我在微信群里问过你的
image

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

3 participants