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
| <template>
| <div class="image-view">
| <img :src="url" @click="previewVisible=true">
| <a-modal :width="width" :visible="previewVisible" :footer="null" @cancel="handleCancel">
| <img alt="example" style="width: 100%" :src="url" />
| </a-modal>
| </div>
| </template>
|
| <script>
| export default {
| name: "ImageView",
| props: {
| url: {
| type: String,
| default: ""
| },
| width: {
| type: Number,
| default: 600
| }
| },
| data() {
| return {
| previewVisible: false,
| }
| },
| methods: {
| handleCancel() {
| this.previewVisible = false;
| },
| }
| }
| </script>
|
| <style scoped>
| .image-view img {
| width: 100%;
| height: auto;
| }
| </style>
|
|