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

isWeb 环境判断建议与 isMiniApp 互斥 #295

Open
xieshiyi opened this issue Mar 23, 2023 · 0 comments
Open

isWeb 环境判断建议与 isMiniApp 互斥 #295

xieshiyi opened this issue Mar 23, 2023 · 0 comments

Comments

@xieshiyi
Copy link

各个api的env判断中web环境判断条件都是最前置的。
但是在支付宝小程序开发过程中,IDE调试时,env.isWeb = true,导致后续逻辑都不正确。
同时env.isMiniApp = true,建议web环境判断更严谨些。

import uni from '@uni/apis';
console.log(uni.application.getApp(), uni.env.isWeb);

打印结果:
image

正确应该是返回 getApp()
image

运行环境:支付宝小程序

// mini.project.json
{
  "format": 2,
  "miniprogramRoot": "src",
  "compileOptions": {
    "component2": true,
    "typescript": true,
    "less": true,
    "enableNodeModuleBabelTransform": true
  }
}
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

1 participant