feat(tabbar): 测试提交
This commit is contained in:
parent
bff59b33b1
commit
775690c405
@ -1,25 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="tabbar-box">
|
<view class="tabbar-box">
|
||||||
<view
|
<view class="items" v-for="(item, index) in tabItems" :key="index" @click="toPage(item.url)">
|
||||||
class="items"
|
<wd-icon :name="item.icon" size="22px"></wd-icon>
|
||||||
@click="toPage('/pages/about/about')"
|
<text>{{ item.title }}</text>
|
||||||
v-for="(item, index) in 4"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<wd-icon name="spool" size="22px"></wd-icon>
|
|
||||||
<text>首页</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<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 }) // 确保传入的是tabBar页面的URL
|
||||||
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
uni.hideTabBar()
|
uni.hideTabBar()
|
||||||
})
|
})
|
||||||
|
|
||||||
const toPage = (pages) => {
|
|
||||||
uni.switchTab({ url: pages })
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user