获取到照片字符串然后push到fileList对应的URL中
if (formData.value.pictures) {let zz = formData.value.pictures.split(",")zz.forEach((item) => {fileList.value.push({ url: item })})}
对应表单
<el-form-item label="内容详情图"><el-uploadaction="/api/v1/upload":headers="{ Authorization: null }":on-remove="handleRemove":on-preview="handlePictureCardPreview"v-model:file-list="fileList":limit="5":auto-upload="true"list-type="picture-card"><el-icon><Plus /></el-icon></el-upload></el-form-item>
保存或修改时,第一次添加到fileList时存在response,第二次没有,这里需要debug观察
formData.value.pictures = ""fileList.value.forEach((item) => {if (item.response) {formData.value.pictures += item.response.data + ","} else {formData.value.pictures += item.url + ","}})formData.value.pictures = formData.value.pictures.slice(0, formData.value.pictures.length - 1)