cv走就可以用,在这里就不多说了
<template> <el-upload class="upload-demo" action="https://c2c.kuxia.top/webapi/index/upload" :on-success="handleSuccess" :on-error="handleError" :on-preview="handlePreview" :on-remove="handleRemove" :before-remove="beforeRemove" :auto-upload="true" multiple list-type="picture"> <el-button size="small" type="primary">选择文件</el-button> <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> </el-upload> </template> <script setup> import { ElUpload } from 'element-plus' const handleSuccess = (response, file, fileList) => { console.log('upload success', response, file, fileList); }; const handleError = (err, file, fileList) => { console.error('upload error', err, file, fileList); }; const handlePreview = (file) => { console.log('preview', file); }; const handleRemove = (file, fileList) => { console.log('remove file', file, fileList); }; const beforeRemove = (file, fileList) => { return confirm('确定移除该文件?'); }; </script> <style scoped> .upload-demo { margin: 20px 0; } </style>