Picture.vue
1.76 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
97
98
99
100
101
102
103
104
105
<template>
<view
class="picture"
v-show="!!detailUrl"
>
<template v-if="isLoading">
<div class="loadding">
<image
class="gif"
src="../../../assets/images/boutique/loadding.gif"
/>
资源加载中
</div>
</template>
<image
class="detail-img"
:src="detailUrl"
mode="widthFix"
@load="load"
/>
</view>
</template>
<script type="text/ecmascript-6">
export default {
name: 'Picture',
props: {
imgUrl: {
type: String,
default: '',
}
},
data () {
return {
detailUrl: '',
isLoading: true
}
},
watch: {
imgUrl (val) {
this.detailUrl = val
this.isLoading = true
}
},
methods: {
load(e) {
this.isLoading = false
}
},
}
</script>
<style scoped lang="scss">
.picture {
font-size: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 998;
min-height: 100vh;
background-color: #fff;
}
.nav-bar {
position: fixed;
width: 100%;
height: toRpx(96);
left: 0;
top: toRpx(48);
z-index: 9;
display: flex;
align-items: center;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
}
.title {
width: 100%;
text-align: center;
}
}
.detail-img {
width: 100%;
height: auto;
object-fit: cover;
}
.loadding {
font-size: 12px;
color: #999;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
overflow: hidden;
.gif {
width: toRpx(64);
height: toRpx(64);
margin-bottom: toRpx(32);
}
}
</style>