Skip to content

uni-helper/uni-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4196b9d · Nov 7, 2024

History

52 Commits
Jul 25, 2024
Oct 27, 2024
Nov 7, 2024
Jul 25, 2024
Apr 14, 2023
Nov 7, 2024
Apr 14, 2023
May 31, 2024
May 24, 2024
May 31, 2024
Nov 7, 2024
Nov 7, 2024
Apr 14, 2023
May 31, 2024

Repository files navigation

@uni-helper/uni-env

在 uni-app 中优雅地判断当前环境。

npm version npm downloads bundle License JSDocs

安装

pnpm i @uni-helper/uni-env

使用

// ESM
import { isMpWeixin } from '@uni-helper/uni-env'

// CommonJS
const { isMp } = require('@uni-helper/uni-env')

Note

这个包更多的是为插件开发者提供,如果你在运行时引入并不能做到条件编译。 要做条件编译的话,请使用官方的 跨端兼容 - 条件编译,如果你需要更好的条件编译,你可以使用 unplugin-preprocessor-directives