showIndexBtn.vue
1.92 KB
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
<template>
<el-row>
<el-col :span="4">
<!-- <a style="color: #409EFF;text-decoration: underline;cursor: pointer;" @click="defaltConfig">恢复默认设置</a> -->
</el-col>
<el-col :span="6" :offset='14'>
<div class="btn-box" v-if="!($Project=='store'&&belongToType=='NewMall')">
<el-button size="mini" :class="item.val==showIndex?'activeBtn':''" @click='getBtnIndex(item.val)' v-for="(item,index) in btnData" :key="index" >{{item.name}}</el-button>
</div>
</el-col>
</el-row>
</template>
<script>
export default {
data() {
return {
btnData:[],
// showIndex:1
}
},
props: {
belongToType: String,
showIndex:{
default:1
}
},
mounted() {
this.getBtnName()
},
watch:{
belongToType:{
handler (newVal,oldVal){
this.getBtnName()
},
immediate:true,
deep:true
},
showIndex:{
handler (newVal,oldVal){
},
immediate:true,
deep:true
}
},
methods: {
defaltConfig(){
alert("恢复默认设置")
},
getBtnIndex(val){
// this.showIndex = val
this.$emit('getShowIndex', val)
},
getBtnName(){
if(this.belongToType=='NewMall'){
this.btnData=[{
name:'客流统计',
val:'1'
},{
name:'客群画像',
val:'2'
}]
}else{
this.btnData=[{
name:'汇总',
val:'1'
},{
name:'详情',
val:'2'
}]
}
}
}
}
</script>
<style scoped="scoped" lang="less">
.btn-box{
text-align: right;
margin-bottom: 15px;
margin-right: 15px;
/deep/.activeBtn{
background-color: #409EFF !important;
color: #fff;
}
/deep/.el-button{
margin-left: 10px;
}
}
</style>