toast.vue
1.64 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
94
95
96
<template>
<view>
<div style="position: relative;">
<slot></slot>
<div class="toast" v-show="toastShow">
<div class="toastContent">
<div class="arrow"></div>
<span class="typeBox" v-for="item in typeArr" @tap="itemClick(item.key)">{{item.name}}</span>
</div>
</div>
</div>
<div class="dialog" v-if="toastShow" @tap="$emit('update:toastShow', false)"></div>
</view>
</template>
<script>
export default{
data() {
return {
}
},
props: {
toastShow:{
type:Boolean,
default:false
},
typeArr: {
type: Array,
default:function(){
return [{
name:"**",
key:""
}]
}
},
},
watch: {
toastShow(newValue, oldValue) {
}
},
methods: {
itemClick(key) {
this.$emit('update:toastShow',false)
this.$emit('handleChange',key);
}
},
}
</script>
<style>
.toast{
position: absolute;
top: 36px;
left: 12px;
z-index: 1001;
box-shadow:0px 3.62upx 7.24upx 0px rgba(0,0,0,0.5);
}
.toastContent{
position: relative;
padding: 0 10.86upx;
background: #FFFFFF;
border-radius:7.24upx ;
}
.dialog{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
background: rgba(0,0,0,0.3);
}
.arrow{
border: 9.06upx solid;
width: 0;
height: 0;
border-color: transparent transparent #FFFFFF transparent;
position: absolute;
top: -18.11upx;
left: 25.36upx;
}
.typeBox{
padding: 19.92upx;
border-bottom: 1px solid #DBDBDB;
color: #000000;
font-size:25.37upx;
display: block;
line-height: normal;
}
.typeBox:last-child{
border-bottom: none;
}
.typeBox:active{
color: #C8C7CC;
}
</style>