fixd:头像上传新增名称
This commit is contained in:
@ -56,7 +56,7 @@
|
||||
</el-col>
|
||||
<el-col :lg="{ span: 2, offset: 6 }" :md="2">
|
||||
<el-button type="primary" :loading="loading" @click="confirmUpload">
|
||||
提 交
|
||||
提 交 yyds
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -175,10 +175,13 @@ function realTime(data: PreviewData) {
|
||||
options.previews = data
|
||||
}
|
||||
const file = shallowRef()
|
||||
const fileName = shallowRef()
|
||||
const cropperURL = useObjectUrl(file)
|
||||
|
||||
onChange((param) => {
|
||||
file.value = param?.item(0)
|
||||
const flName = param?.item(0).name
|
||||
fileName.value = flName.substring(0, flName.lastIndexOf('.'))
|
||||
})
|
||||
|
||||
function selectImage() {
|
||||
@ -203,6 +206,7 @@ async function uploadImg(blob: Blob) {
|
||||
loading = true
|
||||
const formData = new FormData()
|
||||
formData.append('file', blob)
|
||||
formData.append('name', fileName.value)
|
||||
|
||||
try {
|
||||
const res = await props.uploadFunction(formData)
|
||||
|
Reference in New Issue
Block a user