magnifier.vue
1.07 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
<template>
<div>
<el-dialog
title="图片详情"
:fullscreen=true
:visible.sync="dialogVisible"
:before-close="handleClose">
<div class="img-box" :style="'height:'+ height + 'px'">
<img :src="picsrc" alt="">
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleClose">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
data() {
return {
dialogVisible:false,
height:800,
picsrc:'',
}
},
methods:{
handleClose(){
this.$store.commit('setImgsrc','');
this.dialogVisible = false;
}
},
computed:{
...mapState(['imgsrc'])
},
watch:{
imgsrc(val){
if(val != ''){
this.picsrc = val;
this.dialogVisible = true;
}
}
}
}
</script>
<style lang="stylus" scoped>
.img-box{
height 100%
overflow hidden
text-align center
img {
max-width 100%
max-height 100%
}
}
</style>