Files
workspace/code/g3soft-libs/docs/examples/attachment/readonly.vue
T
2026-10-11 22:14:13 +08:00

21 lines
871 B
Vue

<script setup lang="ts">
// 只读:隐藏上传 / 删除入口,只保留浏览与下载
import { G3Attachment } from '@g3soft/ui'
import type { AttachmentItem } from '@g3soft/ui'
const PHOTO = `data:image/svg+xml;utf8,${encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200"><rect width="320" height="200" fill="#dbeafe"/><text x="160" y="108" font-size="18" text-anchor="middle" fill="#1d4ed8">现场照片</text></svg>',
)}`
const files: AttachmentItem[] = [
{ id: 1, name: '立项批复.pdf', size: 320_000 },
{ id: 2, name: '现场照片.jpg', size: 1_024_000, url: PHOTO },
{ id: 3, name: '预算表.xlsx', size: 64_000 },
]
</script>
<template>
<!-- readonly 同时关掉「全选 / 批量删除 / 底栏上传」,拖拽与粘贴也会失效 -->
<G3Attachment :files="files" readonly :height="420" />
</template>