-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreqError.vue
61 lines (52 loc) · 1.22 KB
/
reqError.vue
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
<style lang="css" scoped>
.error {
width: 100%;
height: 100%;
background: white;
font-size: 36px;
/* px */
text-align: center;
position: fixed;
z-index: 99999;
}
.error img {
width: 50px;
height: 50px;
margin: 50% 0 20px 0;
}
.error p {
margin: 0 50px;
}
</style>
<template lang="html">
<!-- v-show控制显示隐藏 -->
<div class="error" @click="refresh" v-show="isShow">
<img src="../assets/ref.jpg">
<p v-if="promShow">{{prom2}}</p>
<p v-else>{{prom1}}</p>
</div>
</template>
<script>
export default {
name: 'reqError',
//接受父级传过来的名为msg的参数
props: ['msg'],
data() {
return {
isShow: false,
promShow: false,
prom1: '请求失败,请点击空白处刷新!',
prom2: '请求失败,网络或者服务存在问题,请退出重试!'
}
},
methods: {
//点击刷新按钮,执行refresh函数
refresh() {
if (this.promShow) return;
this.isShow = false;
//调用父级名为meth的方法,并把count作为参数传过去
this.$parent[this.msg.meth](this.msg.count);
}
}
}
</script>