From c214ebedfb6399406d7ddabee5e859f447bb8094 Mon Sep 17 00:00:00 2001 From: Feng Date: Thu, 28 Mar 2024 17:41:52 +0800 Subject: [PATCH] feat: add the global constant "__UNI_PLATFORM__" --- global.d.ts | 14 ++++++++++++++ src/pages/index/index.vue | 10 ++++++++++ tsconfig.json | 3 ++- vite.config.ts | 4 +++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 global.d.ts diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 0000000..2e67ed8 --- /dev/null +++ b/global.d.ts @@ -0,0 +1,14 @@ +declare const __UNI_PLATFORM__: + | 'h5' + | 'app' + | 'mp-alipay' + | 'mp-baidu' + | 'mp-jd' + | 'mp-kuaishou' + | 'mp-lark' + | 'mp-qq' + | 'mp-toutiao' + | 'mp-weixin' + | 'quickapp-webview' + | 'quickapp-webview-huawei' + | 'quickapp-webview-union' diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index c03f172..878e299 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -17,6 +17,7 @@ unibest 最好用的 uniapp 开发模板 + {{ description }} 在线文档: @@ -40,12 +41,21 @@ + + 当前平台是 - h5 + 当前平台是 - app + 当前平台是 - {{ platform }}