unibest/src/pages/index/index.vue

124 lines
2.6 KiB
Vue
Raw Normal View History

<!-- 使用 type="home" 属性设置首页其他页面不需要设置默认为page推荐使用json5更强大且允许注释 -->
<route lang="json5" type="home">
{
2024-01-09 08:27:40 +08:00
style: { navigationBarTitleText: '首页' },
}
</route>
2023-12-21 15:52:49 +08:00
<template>
2024-01-08 21:24:39 +08:00
<view class="bg-slate-100">
<view class="bg-slate-100 w-full">
<view v-for="item in list" :key="item.url" class="mt-3">
<view
class="flex bg-white items-center justify-between p-3 mb-2"
@click="goDetailPage(item.url)"
>
2024-01-09 09:28:27 +08:00
<text class="flex-1 text-4 text-dark">{{ item.name }}</text>
2024-01-08 21:24:39 +08:00
<text class="i-carbon-chevron-right"></text>
</view>
</view>
2023-12-21 15:52:49 +08:00
</view>
2024-01-08 21:24:39 +08:00
<view class="m-4">
<text>测试配置exclude后还会自动导入页面吗</text>
<PagesAutoImport />
2023-12-22 15:12:44 +08:00
</view>
2023-12-21 15:52:49 +08:00
</view>
</template>
2023-12-21 16:50:50 +08:00
<script setup lang="ts" name="TestIndex">
2023-12-21 15:52:49 +08:00
import { ref } from 'vue'
2024-01-09 09:45:13 +08:00
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
2024-01-08 21:24:39 +08:00
import PagesAutoImport from './components/pages-auto-import.vue'
2024-01-09 09:45:13 +08:00
/** 激活“分享给好友” */
onShareAppMessage((options: Page.ShareAppMessageOption): Page.CustomShareContent => {
console.log('options:', options)
return {
title: '自定义分享标题',
path: '/pages/index/index?id=xxx',
imageUrl:
'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png',
}
})
/** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */
onShareTimeline((): Page.ShareTimelineContent => {
return {
title: '自定义分享标题',
query: 'a=1&b=2',
}
})
2023-12-23 11:27:00 +08:00
2024-01-08 21:24:39 +08:00
const list = ref([
{
name: 'UnoCSS',
url: 'unocss',
},
{
name: 'UnoCSS Icons',
url: 'unocss-icons',
},
{
name: 'UniUI',
url: 'uni-ui',
},
{
name: 'UniUI Icons',
url: 'uni-ui-icons',
},
{
name: 'Pinia+持久化',
url: 'pinia',
},
{
name: '微信分享',
url: 'mp-weixin-share',
},
{
name: '自定义导航栏',
url: 'navbar',
},
{
name: '自定义导航栏渐变',
2024-01-08 21:28:03 +08:00
url: 'throughout',
2024-01-08 21:24:39 +08:00
},
{
name: '请求封装+请求拦截器',
url: 'request',
},
{
name: 'page自动引入',
url: 'pages-auto-import',
},
])
const goDetailPage = (path: string) => {
const url = `/pages/index/demo/${path}`
uni.navigateTo({
url,
2023-12-23 11:39:46 +08:00
})
}
2023-12-21 15:52:49 +08:00
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
width: 200rpx;
height: 200rpx;
margin: 200rpx auto 50rpx;
2023-12-21 15:52:49 +08:00
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>