index.vue
1.02 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
<template>
<div class="checkBox" @click="updateValue">
<span class="checkItem allSelected" v-show="type === 'all' && value"></span>
<span class="checkItem noSelected" v-show="!value"></span>
<font><slot></slot></font>
</div>
</template>
<script>
export default {
name: 'isCheckAll',
methods: {
updateValue () {
this.$emit('update:value', !this.value)
}
},
props: {
value: {
type: Boolean,
default: false
},
type: {
type: String,
default: 'all'
}
}
}
</script>
<style lang="less">
.checkBox {
display: inline-block;
.checkItem {
display: inline-block;
width: 1.3rem;
height: 1.3rem;
text-align: center;
vertical-align: middle;
background-size: cover;
}
.allSelected {
background-image: url(../../assets/all.png);
}
.partSelected {
background-image: url(../../assets/part.png);
}
.noSelected {
background-image: url(../../assets/no.png);
}
font {
font-size: 0.9rem;
vertical-align: middle;
}
}
</style>