unibest/src/pages/index/index.vue

72 lines
2.2 KiB
Vue
Raw Normal View History

<!-- 使用 type="home" 属性设置首页其他页面不需要设置默认为page推荐使用json5更强大且允许注释 -->
<route lang="json5" type="home">
{
2024-05-11 09:41:33 +08:00
layout: 'tabbar',
2024-01-24 13:55:06 +08:00
style: {
2024-01-29 18:59:17 +08:00
navigationStyle: 'custom',
navigationBarTitleText: '首页',
2024-01-24 13:55:06 +08:00
},
}
</route>
2023-12-21 15:52:49 +08:00
<template>
<view
2024-03-03 15:21:26 +08:00
class="bg-white overflow-hidden pt-2 px-4"
:style="{ marginTop: safeAreaInsets?.top + 'px' }"
>
2024-01-28 18:58:05 +08:00
<view class="mt-12">
2024-02-11 03:50:24 +08:00
<image src="/static/logo.svg" alt="" class="w-28 h-28 block mx-auto" />
2023-12-22 15:12:44 +08:00
</view>
2025-06-13 18:33:25 +08:00
<view class="text-center text-4xl text-[#d14328] 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>
2024-04-17 15:32:15 +08:00
<view class="text-center mt-8">
当前平台是
<text class="text-green-500">{{ PLATFORM.platform }}</text>
</view>
<view class="text-center mt-4">
模板分支是
2024-04-20 10:53:07 +08:00
<text class="text-green-500">tabbar</text>
2024-03-03 19:07:16 +08:00
</view>
2023-12-21 15:52:49 +08:00
</view>
</template>
<script lang="ts" setup>
2024-04-17 15:32:15 +08:00
import PLATFORM from '@/utils/platform'
defineOptions({
name: 'Home',
})
2024-01-29 18:53:57 +08:00
// 获取屏幕边界到安全区域距离
let safeAreaInsets
2025-06-13 18:33:25 +08:00
let systemInfo
// #ifdef MP-WEIXIN
// 微信小程序使用新的API
2025-06-13 18:33:25 +08:00
systemInfo = uni.getWindowInfo()
safeAreaInsets = systemInfo.safeArea
? {
top: systemInfo.safeArea.top,
right: systemInfo.windowWidth - systemInfo.safeArea.right,
bottom: systemInfo.windowHeight - systemInfo.safeArea.bottom,
left: systemInfo.safeArea.left,
}
: null
// #endif
// #ifndef MP-WEIXIN
// 其他平台继续使用uni API
2025-06-13 18:33:25 +08:00
systemInfo = uni.getSystemInfoSync()
safeAreaInsets = systemInfo.safeAreaInsets
// #endif
2024-01-30 09:55:42 +08:00
const author = ref('菲鸽')
const description = ref(
'unibest 是一个集成了多种工具和技术的 uniapp 开发模板,由 uniapp + Vue3 + Ts + Vite6 + UnoCss + VSCode 构建,模板具有代码提示、自动格式化、统一配置、代码片段等功能,并内置了许多常用的基本组件和基本功能,让你编写 uniapp 拥有 best 体验。',
)
2024-06-16 16:46:58 +08:00
// 测试 uni API 自动引入
2024-01-30 09:55:42 +08:00
onLoad(() => {
2025-05-19 15:57:30 +08:00
console.log('项目作者:', author.value)
2024-01-30 09:55:42 +08:00
})
</script>