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,9 +89,11 @@ function handleExceed(files: UploadFile[]) {
* *
* @param file * @param file
*/ */
function handleRemove(file: string) { function handleRemove(file: string | null) {
if (file) {
deleteFile(file) deleteFile(file)
imgUrl.value = null // 这里会触发imgUrl的computed的set方法 imgUrl.value = null // 这里会触发imgUrl的computed的set方法
}
} }
function handleBeforeUpload(file: any) { function handleBeforeUpload(file: any) {
@@ -111,7 +113,7 @@ function handleBeforeUpload(file: any) {
<style lang="scss" scoped> <style lang="scss" scoped>
.component-container{ .component-container {
.single-uploader { .single-uploader {
cursor: pointer; cursor: pointer;
position: relative; position: relative;
@@ -120,16 +122,19 @@ function handleBeforeUpload(file: any) {
&:hover { &:hover {
border-color: #409EFF; border-color: #409EFF;
} }
&-icon{
&-icon {
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
text-align: center; text-align: center;
} }
&-image{
&-image {
width: 146px; width: 146px;
height: 146px; height: 146px;
display: block; display: block;
} }
&-remove-icon { &-remove-icon {
font-size: 12px; font-size: 12px;
color: #ff4d51 !important; color: #ff4d51 !important;