Merge remote-tracking branch 'origin/base' into base

This commit is contained in:
菲鸽 2024-03-28 19:05:57 +08:00
commit e3b6ad2c89
4 changed files with 29 additions and 2 deletions

14
global.d.ts vendored Normal file
View File

@ -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'

View File

@ -17,6 +17,7 @@
</view>
<view class="text-center text-4xl main-title-color mt-4">unibest</view>
<view class="text-center text-2xl mt-2 mb-8">最好用的 uniapp 开发模板</view>
<view class="text-justify max-w-100 m-auto text-4 indent mb-2">{{ description }}</view>
<view class="mt-8 text-center">
<text class="text-green-400">在线文档</text>
@ -40,12 +41,21 @@
</a>
<!-- #endif -->
</view>
<view class="text-center py-4" v-if="isH5">当前平台是 - h5</view>
<view class="text-center py-4" v-else-if="isApp">当前平台是 - app</view>
<view class="text-center py-4" v-else>当前平台是 - {{ platform }}</view>
</view>
</template>
<script lang="ts" setup>
//
const { safeAreaInsets } = uni.getSystemInfoSync()
const platform = __UNI_PLATFORM__
const isH5 = __UNI_PLATFORM__ === 'h5'
const isApp = __UNI_PLATFORM__ === 'app'
const isMP = __UNI_PLATFORM__.startsWith('mp-')
const isQuickApp = __UNI_PLATFORM__.startsWith('quickapp-')
const author = ref('菲鸽')
const description = ref(

View File

@ -17,7 +17,8 @@
"@dcloudio/types",
"@types/wechat-miniprogram",
"@uni-helper/uni-app-types",
"wot-design-uni/global.d.ts"
"wot-design-uni/global.d.ts",
"./global.d.ts"
]
},
"vueCompilerOptions": {

View File

@ -108,7 +108,9 @@ export default ({ command, mode }) => {
// TODO: 缓存每次压缩过的图片,已经压缩过的不再压缩
imagemin(mode === 'production'),
],
define: {
__UNI_PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
},
css: {
postcss: {
plugins: [