jiangping
2023-08-21 2837bdd57f72e386bbf9a725e7b3a13e5eb9e930
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
    <view>
        <u-tabbar
            :value="index"
            @change="change"
            fixed
            activeColor="#222"
            inactiveColor="#666"
        >
            <u-tabbar-item text="待办">
                <view class="" slot="active-icon"> 
                    <image src="@/static/nav_daiban_sel@2x.png" class="icon-style" mode=""></image>
                </view>
                <view class="" slot="inactive-icon"> 
                    <image src="@/static/nav_daiban@2x.png" class="icon-style" mode=""></image>
                </view>
            </u-tabbar-item>
            <u-tabbar-item text="工作台">
                <view class="" slot="active-icon">
                    <image src="@/static/nav_gongzuotai_sel@2x.png" class="icon-style" mode=""></image>
                </view>
                <view class="" slot="inactive-icon"> 
                    <image src="@/static/nav_gongzuotai@2x.png" class="icon-style" mode=""></image>
                </view>
            </u-tabbar-item>
            <u-tabbar-item text="我的">
                <view class="" slot="active-icon">
                    <image src="@/static/nav_wode_sel@2x.png" class="icon-style" mode=""></image>
                </view>
                <view class="" slot="inactive-icon"> 
                    <image src="@/static/nav_wode@2x.png" class="icon-style" mode=""></image>
                </view>
            </u-tabbar-item>
        </u-tabbar>
    </view>
</template>
 
<script>
    export default {
        name:"myTabbar",
        props: {
            index: 0
        },
        data() {
            return {
                value: 0
            };
        },
        methods: {
            click(index) {
                // console.log('click', index);
                // this.$nextTick(() => {
                //     this.value = index
                //     if (index==0) {
                //         uni.switchTab({
                //             url: '/pages/index/index'
                //         });
                //     } else if (index== 1) {
                //         uni.switchTab({
                //             url: '/pages/service/service'
                //         });
                //     }else {
                //         uni.switchTab({
                //             url: '/pages/mine/mine'
                //         });
                //     }
                // })
            },
            change(index) {
                this.$nextTick(() => {
                    this.value = index
                })
                
                console.log(index);
                if (index==0) {
                    // console.log('index');
                    uni.switchTab({
                        url: '/pages/index/index'
                    });
                } else if (index== 1) {
                    // console.log('workbench');
                    uni.switchTab({
                        url: '/pages/workbench/workbench'
                    });
                }else {
                    // console.log('mine');
                    uni.switchTab({
                        url: '/pages/mine/mine'
                    });
                }
            }
        },
    }
    /**
     *
     * */
</script>
 
<style lang="scss" scope>
.icon-style {
    width: 44rpx;
    height: 44rpx;
}
</style>