Kaynağa Gözat

feat(about): 添加环境判断工具导入和使用说明

添加@uni-helper/uni-env环境判断工具的导入,并在控制台打印环境变量用于调试
添加注释说明isH5和isWeb的区别,建议优先使用isH5
feige996 8 ay önce
ebeveyn
işleme
c343c7c5f9
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  1. 4 0
      src/pages/about/about.vue

+ 4 - 0
src/pages/about/about.vue

@@ -1,4 +1,5 @@
 <script lang="ts" setup>
+import { isApp, isAppAndroid, isAppHarmony, isAppIOS, isAppPlus, isH5, isMpWeixin, isWeb } from '@uni-helper/uni-env'
 import { LOGIN_PAGE } from '@/router/config'
 import { tabbarStore } from '@/tabbar/store'
 import RequestComp from './components/request.vue'
@@ -10,6 +11,9 @@ definePage({
   },
 })
 
+// 浏览器打印 isH5为true, isWeb为false,大家尽量用 isH5
+console.log({ isApp, isAppAndroid, isAppHarmony, isAppIOS, isAppPlus, isH5, isMpWeixin, isWeb })
+
 function toLogin() {
   uni.navigateTo({
     url: `${LOGIN_PAGE}?redirect=${encodeURIComponent('/pages/about/about')}`,