feat: about.vue 页面测试 __UNI_PLATFORM__

This commit is contained in:
菲鸽 2024-03-28 19:13:09 +08:00
parent e3b6ad2c89
commit 965a87279a
2 changed files with 11 additions and 9 deletions

View File

@ -19,6 +19,11 @@
<view class="text-center mt-8"> <view class="text-center mt-8">
<wd-button type="primary">wot 组件库测试</wd-button> <wd-button type="primary">wot 组件库测试</wd-button>
</view> </view>
<view class="text-center py-4">
当前平台是
<text class="text-red-500">{{ platform }}</text>
</view>
<view class="desc">测试设计稿样式</view> <view class="desc">测试设计稿样式</view>
<view class="desc">设计稿是750pxcss里面全部写rpx 即可</view> <view class="desc">设计稿是750pxcss里面全部写rpx 即可</view>
</view> </view>
@ -27,6 +32,12 @@
<script lang="ts" setup> <script lang="ts" setup>
// //
const { safeAreaInsets } = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
const platform = __UNI_PLATFORM__
const isH5 = __UNI_PLATFORM__ === 'h5'
const isApp = __UNI_PLATFORM__ === 'app'
const isMp = __UNI_PLATFORM__.startsWith('mp-')
console.log(platform, isH5, isApp, isMp)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -41,21 +41,12 @@
</a> </a>
<!-- #endif --> <!-- #endif -->
</view> </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> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// //
const { safeAreaInsets } = uni.getSystemInfoSync() 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 author = ref('菲鸽')
const description = ref( const description = ref(