fix(SingleUpload.vue): 修复handleRemove的TypeScript编译报错问题

This commit is contained in:
郝先瑞
2022-01-23 00:46:07 +08:00
parent 506f5bf006
commit 1daa5c17ff

View File

@@ -89,10 +89,12 @@ function handleExceed(files: UploadFile[]) {
*
* @param file
*/
function handleRemove(file: string) {
function handleRemove(file: string | null) {
if (file) {
deleteFile(file)
imgUrl.value = null // 这里会触发imgUrl的computed的set方法
}
}
function handleBeforeUpload(file: any) {
const isJPG = file.type === 'image/jpeg'
@@ -120,16 +122,19 @@ function handleBeforeUpload(file: any) {
&:hover {
border-color: #409EFF;
}
&-icon {
font-size: 28px;
color: #8c939d;
text-align: center;
}
&-image {
width: 146px;
height: 146px;
display: block;
}
&-remove-icon {
font-size: 12px;
color: #ff4d51 !important;