图片上传组件预览新增复制地址

This commit is contained in:
不做码农 2023-07-13 13:00:12 +08:00
parent b45d893a60
commit 89b6be286d

View File

@ -31,8 +31,23 @@
的文件 的文件
</div> </div>
<el-dialog v-model="dialogVisible" title="预览" width="800px" append-to-body> <el-dialog v-model="dialogVisible" append-to-body>
<img :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto" /> <el-form label-width="100px">
<el-form-item label="预览">
<el-image style="display: block; max-width: 50%" :src="dialogImageUrl">
<template #error>
<div class="image-slot">加载失败</div>
</template>
</el-image>
</el-form-item>
<el-form-item label="访问路径">
<el-link type="warning" :href="dialogImageUrl" target="_blank">{{ dialogImageUrl }}</el-link>
<el-button type="danger" text icon="document-copy" plain class="ml10" v-clipboard:success="copySuccess" v-clipboard:copy="dialogImageUrl"
>复制</el-button
>
</el-form-item>
</el-form>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -45,27 +60,27 @@ const props = defineProps({
// //
limit: { limit: {
type: Number, type: Number,
default: 5, default: 5
}, },
// (MB) // (MB)
fileSize: { fileSize: {
type: Number, type: Number,
default: 5, default: 5
}, },
// , ['png', 'jpg', 'jpeg'] // , ['png', 'jpg', 'jpeg']
fileType: { fileType: {
type: Array, type: Array,
default: () => ['png', 'jpg', 'jpeg'], default: () => ['png', 'jpg', 'jpeg']
}, },
// //
isShowTip: { isShowTip: {
type: Boolean, type: Boolean,
default: true, default: true
}, },
// //
data: { data: {
type: Object, type: Object
}, }
}) })
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -102,7 +117,7 @@ watch(
return [] return []
} }
}, },
{ deep: true, immediate: true }, { deep: true, immediate: true }
) )
// //
@ -187,4 +202,7 @@ function listToString(list, separator) {
} }
return strs != '' ? strs.substr(0, strs.length - 1) : '' return strs != '' ? strs.substr(0, strs.length - 1) : ''
} }
function copySuccess() {
proxy.$modal.msgSuccess('复制成功')
}
</script> </script>