refactor: platform 环境

This commit is contained in:
菲鸽
2024-03-28 19:25:41 +08:00
parent 965a87279a
commit b17de63bec
2 changed files with 21 additions and 6 deletions

17
src/utils/platform.ts Normal file
View File

@@ -0,0 +1,17 @@
/*
* @Author: 菲鸽
* @Date: 2024-03-28 19:13:55
* @Last Modified by: 菲鸽
* @Last Modified time: 2024-03-28 19:24:55
*/
export const platform = __UNI_PLATFORM__
export const isH5 = __UNI_PLATFORM__ === 'h5'
export const isApp = __UNI_PLATFORM__ === 'app'
export const isMp = __UNI_PLATFORM__.startsWith('mp-')
const PLATFORM = {
platform,
isH5,
isApp,
isMp,
}
export default PLATFORM