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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!--
* @Author: jiangzaicheng jiangzaicheng_jzc@163.com
* @Date: 2022-07-07 16:13:13
* @LastEditors: jiangzaicheng jiangzaicheng_jzc@163.com
* @LastEditTime: 2022-07-11 18:19:25
* @FilePath: \mcep-h5\src\components\common\Bottom.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<!-- <div> -->
<div class="d-bottom">
<van-tabbar style=" width:100%; ">
<van-tabbar-item v-for="(item, index) in tabbar" :key="index">
<div style="margin-top: 50%;" @click="btn(index)">
<svg class="icon" aria-hidden="true">
<use :xlink:href="item.img"></use>
</svg>
<p :class="item.flag ? 'approve-type-div-selected-df' : 'approve-type-div-df'">{{ item.name }}</p>
</div>
</van-tabbar-item>
</van-tabbar>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch, Emit } from "vue-property-decorator";
//import MainViw from "@/views/main/MainView.vue";
/*
* title
*/
@Component({
name: "Bottom",
})
export default class Bottom extends Vue {
myBtnImage: any = "#icon-a-wode24x24px-kehujinglixiaochengxu";
onchangeImage: any = "#icon-a-shouye-xuanzhong20x20px";
btnFlag: any = true
pl = "pl";
tabbar: any = [
{
img: "#icon-a-shouye-xuanzhong20x20px",
name: "首页",
flag: true
},
{
img: "#icon-a-wode24x24px-kehujinglixiaochengxu",
name: "我的",
flag: false
}
];
btn(index: number) {
//alert(index);
if (index == 0) {//如果索引是0说明点击了首页
this.tabbar[1].img = "#icon-a-wode24x24px-kehujinglixiaochengxu";//将我的按钮置灰
this.tabbar[1].flag = "false";//将我的按钮置灰
this.tabbar[0].img = "#icon-a-shouye-xuanzhong20x20px";//将首页切换为蓝色
this.tabbar[0].flag = true;
this.tabbar[1].flag = false;
this.onchangebtn()
} else if (index == 1) {
this.tabbar[0].img = "#icon-a-shouye20x20px";//将首页置灰
this.tabbar[1].img = "#icon-a-wode-xuanzhong24x24px-kehujinglixiaochengxu";//将我的按钮直为蓝色
this.tabbar[0].flag = false;
this.tabbar[1].flag = true;
this.onchangebtn()
}
}
//传给父组件
onchangebtn() {
this.btnFlag=!this.btnFlag
this.$emit('onchangebtn', this.btnFlag);
}
}
</script>
<style scoped lang="scss">
.d-bottom {
width: 100%;
height: 100%;
border-width: 0px;
background: inherit;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 0px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 12px;
line-height: 20px;
text-align: center;
}
.approve-type-div-selected-df {
color: cornflowerblue;
}
.approve-type-div-df {
color: #CCCCCC;
}
.pl {
width: 100%;
height: 100%;
font-family: 'FontAwesome', sans-serif;
font-weight: 400;
font-style: normal;
color: #CCCCCC;
line-height: 20px;
}
.icon {
width: 24px;
height: 24px;
}
</style>