feat(tabbar): 测试提交

This commit is contained in:
ygytsyjj 2025-01-02 17:17:24 +08:00
parent bff59b33b1
commit 775690c405

View File

@ -1,25 +1,35 @@
<template>
<view class="tabbar-box">
<view
class="items"
@click="toPage('/pages/about/about')"
v-for="(item, index) in 4"
:key="index"
>
<wd-icon name="spool" size="22px"></wd-icon>
<text>首页</text>
<view class="items" v-for="(item, index) in tabItems" :key="index" @click="toPage(item.url)">
<wd-icon :name="item.icon" size="22px"></wd-icon>
<text>{{ item.title }}</text>
</view>
</view>
</template>
<script lang="ts" setup>
defineProps({
tabItems: {
type: Array,
required: true,
validator(value) {
return value.every(
(item) =>
Object.prototype.hasOwnProperty.call(item, 'url') &&
Object.prototype.hasOwnProperty.call(item, 'icon') &&
Object.prototype.hasOwnProperty.call(item, 'title'),
)
},
},
})
const toPage = (url: string) => {
uni.switchTab({ url }) // tabBarURL
}
onLoad(() => {
uni.hideTabBar()
})
const toPage = (pages) => {
uni.switchTab({ url: pages })
}
</script>
<style lang="scss" scoped>