quanyawei
2023-10-27 52d463e03c1f074099ed8e8a6b7c3ddde52d2708
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<template>
    <view class="tabarStyle">
        <u-tabbar :value="value" @change="name => value = name" :fixed="true" :placeholder="true"
            :safeAreaInsetBottom="true">
            <u-tabbar-item text="首页" @click="clickTo" icon="home"></u-tabbar-item>
            <u-tabbar-item text="新建交办单" icon="plus-circle" @click="clickTo"></u-tabbar-item>
            <u-tabbar-item text="我的" icon="account" @click="clickTo"></u-tabbar-item>
        </u-tabbar>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                value: 0,
            }
        },
        props: {
            currIndex: {
                type: String,
                default: '0'
            },
        },
        watch: {
            currIndex(newValue, oldValue) {
                console.log('currIndex', newValue)
                this.value = Number(newValue)
            }
        },
        mounted() {
            this.value = Number(this.currIndex)
        },
        methods: {
            clickTo(index) {
                this.$emit('handleChangeTabe', index)
            }
        }
    }
</script>
<style scoped lang="scss">
</style>