liangjin
2021-04-22 dd10ca005982177d11183cba1fc690aca8ede7d6
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
/*
 * @Author: hzq
 * @Date: 2018-08-08 10:08:52
 * @Last Modified by: hzq
 * @Last Modified time: 2018-08-23 09:38:25
 * @文件说明: 底部tabbar选项组件
 * @使用方式:<f-footer index="2"></f-footer>
 */
<template>
    <tabbar class="tabbar">
        <tabbar-item v-for="(i,index) in footerMenu" :key="index" :selected="index===currIndex" @on-item-click="$router.push(i.router)">
            <i slot="icon" class="iconfont" :class="i.icon"></i>
            <span slot="label">{{i.label}}</span>
        </tabbar-item>
    </tabbar>
</template>
 
<script>
    import {Tabbar, TabbarItem} from 'vux';
 
    export default {
        name: 'f-footer',
        components: {Tabbar, TabbarItem},
        data() {
            return {
                footerMenu: []
            };
        },
        computed: {
            currIndex() {
                return this.footerMenu.findIndex(val => {
                    return val.router === this.$route.path;
                });
            }
        },
        created() {
            this.footerMenu = sessionStorage.getItem('footerMenu');
        }
    };
</script>
 
<style lang="less" scoped>
    .tabbar {
        position: fixed;
        height: 49px;
        z-index: 499;
        &::before {
            border-top-color: @color-line !important;
        }
        & /deep/ .weui-tabbar__icon {
            height: 24px;
            .iconfont {
                font-size: @font-size-primary;
            }
        }
    }
</style>