Blame view

src/views/demo/feat/img-preview/index.vue 791 Bytes
陈文彬 authored
1
<template>
2
  <PageWrapper title="图片预览示例">
vben authored
3
    <ImagePreview :imageList="imgList" />
4
    <a-button @click="openImg" type="primary">无预览图</a-button>
5
  </PageWrapper>
陈文彬 authored
6
7
8
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
9
  import { createImgPreview, ImagePreview } from '/@/components/Preview/index';
10
11
  import { PageWrapper } from '/@/components/Page';
陈文彬 authored
12
13
14
15
16
17
  const imgList: string[] = [
    'https://picsum.photos/id/66/346/216',
    'https://picsum.photos/id/67/346/216',
    'https://picsum.photos/id/68/346/216',
  ];
  export default defineComponent({
18
    components: { PageWrapper, ImagePreview },
陈文彬 authored
19
    setup() {
20
21
22
23
      function openImg() {
        createImgPreview({ imageList: imgList });
      }
      return { imgList, openImg };
陈文彬 authored
24
25
26
    },
  });
</script>