feat: 图片上传/回显支持绑定string类型

This commit is contained in:
dap
2024-10-09 22:20:09 +08:00
parent 99a0c63f92
commit 961f65215d
3 changed files with 37 additions and 8 deletions

View File

@@ -16,10 +16,24 @@ const fieldOptions = [
{ label: '链接地址', value: 'url' },
];
const fileAccept = ['txt', 'excel', 'word', 'pdf'];
const signleImage = ref<string>('');
</script>
<template>
<Page content-class="flex flex-col gap-[12px]">
<div class="bg-background flex flex-col gap-[12px] rounded-lg p-6">
<Alert
:show-icon="true"
message="新特性: 单张图片会被绑定为string而非string[]类型 省去手动转换"
/>
<ImageUpload v-model:value="signleImage" :max-number="1" />
<Alert
:show-icon="true"
message="默认给空字符串会被转为[], 上传之后为正常string类型"
/>
<JsonPreview :data="signleImage" />
</div>
<div class="bg-background flex flex-col gap-[12px] rounded-lg p-6">
<div class="flex gap-[8px]">
<span>返回字段: </span>