select-comp.vue
1.48 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
<template>
<div class="select-comp">
<div class="select-comp__mask__btn" @click="cb && cb($event)">编辑</div>
<div v-if="showDelete" class="select-comp__mask__btn__del" @click="del && del($event)">删除</div>
<div class="select-comp__mask"></div>
<slot></slot>
</div>
</template>
<script>
export default {
name: 'select-comp',
props: ['cb', 'del', 'showDelete']
}
</script>
<style>
.select-comp {
position: relative;
}
.select-comp:hover .select-comp__mask {
display: block;
}
.select-comp__mask {
position: absolute;
display: none;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.5);
}
.select-comp:hover .select-comp__mask__btn {
display: block;
}
.select-comp:hover .select-comp__mask__btn__del {
display: block;
}
.select-comp__mask__btn {
z-index: 90;
width: 60px;
height: 20px;
position: absolute;
display: none;
top: 0;
right: 0;
cursor: pointer;
color: white;
background-color: gray;
text-align: center;
}
.select-comp__mask__btn__del {
z-index: 90;
width: 60px;
height: 20px;
position: absolute;
display: none;
top: 0;
right: 60px;
cursor: pointer;
color: white;
background-color: red;
text-align: center;
}
</style>