
<template>
    <view>
        <wd-tabbar v-model="tabbar"  active-color="#4C9F44" inactive-color="#707070" fixed safeAreaInsetBottom @change="Tabbar.handleChange">
            <wd-tabbar-item title="收益明细" name="bill">
                <template #icon>
                    <wd-img height="40rpx" width="40rpx" :src="tab === 'bill' ? `${OSS}images/parten/parten_bill_s.png` : `${OSS}images/parten/parten_bill.png`"></wd-img>
                </template>
            </wd-tabbar-item>
            <wd-tabbar-item title="下级用户" name="sub">
                <template #icon>
                    <wd-img height="40rpx" width="40rpx" :src="tab === 'sub' ? `${OSS}images/parten/parten_sub_s.png` : `${OSS}images/parten/parten_sub.png`"></wd-img>
                </template>
            </wd-tabbar-item>
            <wd-tabbar-item title="我的" name="my">
                <template #icon>
                    <wd-img height="40rpx" width="40rpx" :src="tab === 'my' ? `${OSS}images/parten/parten_my_s.png` : `${OSS}images/parten/parten_my.png`"></wd-img>
                </template>
            </wd-tabbar-item>
        </wd-tabbar>
	</view>
</template>

<script lang="ts" setup name="Tabbar">
	const OSS = inject('OSS')

    const props = defineProps({
        tab: {
            type: String,
            default: 'bill'
        }
    })

    const tabbar = ref<string>(props.tab)


    const Tabbar = {
        handleChange: ({ value }: { value: string }) => {
            // console.log("🚀 ~ value:", value)
            // tabbar.value = value
            // console.log("🚀 ~ value:", tabbar.value)

            if (value === 'bill') {
                uni.redirectTo({
                    url: '/bundle/parten/pages/bill/bill'
                })
            } else if (value === 'sub') {
                uni.redirectTo({
                    url: '/bundle/parten/pages/sub/sub'
                })
            } else if (value === 'my') {
                uni.redirectTo({
                    url: '/bundle/parten/pages/my/my'
                })
            }
        }

    }
    // 切换tabbar
</script>

<script lang="ts">
    export default {}
</script>

<style lang="scss" scoped>
//
</style>
