pnpm i @unicom-blockchain/file-preview
<template>
<div>
<FilePreview ref="previewRef"></FilePreview>
<button @click="preview"></button>
</div>
</template>
<script setup lang="ts">
import { FilePreview } from '@unicom-blockchain/file-preview';
import { ref } from 'vue';
const previewRef = ref<InstanceType<typeof FilePreview>>();
function preview() {
if (previewRef.value) {
previewRef.value.preview(
{
name: 'aaa.png',
type: 'file',
contentType: 'image/png',
},
new Blob(),
);
}
}
</script>
<style scoped></style>