File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default {
1919 },
2020 methods: {
2121 handleAvatarSuccess (res , file , fileList ) {
22- this .$emit (' update:value' , res . data )
22+ this .$emit (' update:value' , URL . createObjectURL ( file . raw ) )
2323 this .fullLoading .close ()
2424 },
2525 uploadError (err , file , fileList ) {
@@ -28,13 +28,14 @@ export default {
2828 this .$alert (' 网络繁忙,请稍后重试' )
2929 },
3030 beforeAvatarUpload (file ) {
31- const isLt2M = file .size / 1024 / 1024 < 1 ;
31+ const isLt2M = file .size / 1024 < 20 ;
3232 if (! isLt2M) {
33- this .$message .error (' 上传图片大小不能超过 1MB!' );
33+ this .$message .error (' 上传图片大小不能超过 20 KB!' );
34+ } else {
35+ this .fullLoading = this .$loading ({
36+ text: ' 正在上传'
37+ });
3438 }
35- this .fullLoading = this .$loading ({
36- text: ' 正在上传'
37- });
3839 return isLt2M;
3940 },
4041 }
Original file line number Diff line number Diff line change 5252 </el-form-item >
5353 <template v-if =" selectWg .type === ' imgShow' " >
5454 <el-form-item label =" 图片上传" >
55- <el-upload
56- class =" avatar-uploader"
57- :action =" $api.apiUrl()+'supermarketloan/mgr/eventmarket/uploadeventmarketimg'"
58- :show-file-list =" false"
59- :on-success =" handleAvatarSuccess"
60- :before-upload =" beforeAvatarUpload"
61- :on-error =" uploadError"
62- >
63- <img v-if =" selectWg.value" :src =" selectWg.value" class =" avatar" >
64- <i v-else class =" el-icon-plus avatar-uploader-icon" ></i >
65- </el-upload >
55+ <ImgUpload :value .sync =" selectWg .value " />
6656 </el-form-item >
6757 </template >
6858 </el-collapse-item >
You can’t perform that action at this time.
0 commit comments