img
This commit is contained in:
		
							parent
							
								
									6a15bbb2e0
								
							
						
					
					
						commit
						c0e40bee86
					
				| @ -74,7 +74,7 @@ const _sfc_main = defineComponent({ | ||||
|       return new Promise((resolve, reject) => { | ||||
|         var options = { | ||||
|           file, | ||||
|           quality: 0.6, | ||||
|           quality: props.quality, | ||||
|           mimeType: "image/jpeg", | ||||
|           maxWidth: 2e3, | ||||
|           maxHeight: 2e3, | ||||
| @ -194,7 +194,12 @@ const _sfc_main = defineComponent({ | ||||
|       if (Array.isArray(files) && files.length > 0) { | ||||
|         for (let i = 0; i < files.length; i++) { | ||||
|           let _file = files[i]; | ||||
|           let f = await imgcomp(_file); | ||||
|           let f; | ||||
|           if (props.quality) { | ||||
|             f = await imgcomp(_file); | ||||
|           } else { | ||||
|             f = _file; | ||||
|           } | ||||
|           formData.append(props.field + "[" + i + "]", f); | ||||
|         } | ||||
|       } | ||||
|  | ||||
| @ -48982,7 +48982,7 @@ const _sfc_main$7 = defineComponent({ | ||||
|       return new Promise((resolve, reject) => { | ||||
|         var options = { | ||||
|           file, | ||||
|           quality: 0.6, | ||||
|           quality: props.quality, | ||||
|           mimeType: "image/jpeg", | ||||
|           maxWidth: 2e3, | ||||
|           maxHeight: 2e3, | ||||
| @ -49102,7 +49102,12 @@ const _sfc_main$7 = defineComponent({ | ||||
|       if (Array.isArray(files) && files.length > 0) { | ||||
|         for (let i = 0; i < files.length; i++) { | ||||
|           let _file = files[i]; | ||||
|           let f = await imgcomp(_file); | ||||
|           let f; | ||||
|           if (props.quality) { | ||||
|             f = await imgcomp(_file); | ||||
|           } else { | ||||
|             f = _file; | ||||
|           } | ||||
|           formData.append(props.field + "[" + i + "]", f); | ||||
|         } | ||||
|       } | ||||
|  | ||||
| @ -79,11 +79,11 @@ export interface UploadProps { | ||||
|   quality?: number; | ||||
| } | ||||
| 
 | ||||
| function imgcomp(file: any) { | ||||
| function imgcomp(file: any): Promise<Blob> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     var options = { | ||||
|       file: file, | ||||
|       quality: 0.6, | ||||
|       quality: props.quality, | ||||
|       mimeType: "image/jpeg", | ||||
|       maxWidth: 2000, | ||||
|       maxHeight: 2000, | ||||
| @ -252,7 +252,12 @@ const localUploadTransaction = async (option: localUploadTransaction) => { | ||||
|   if (Array.isArray(files) && files.length > 0) { | ||||
|     for (let i = 0; i < files.length; i++) { | ||||
|       let _file = files[i]; | ||||
|       let f = await imgcomp(_file); | ||||
|       let f: File | Blob; | ||||
|       if (props.quality) { | ||||
|         f = await imgcomp(_file); | ||||
|       } else { | ||||
|         f = _file; | ||||
|       } | ||||
|       formData.append(props.field + "[" + i + "]", f); | ||||
|     } | ||||
|   } | ||||
| @ -482,10 +487,10 @@ onUnmounted(() => { | ||||
|       </div> | ||||
|     </div> | ||||
|     <div v-else ref="dragRef" class="layui-upload-drag" :class="disabled | ||||
|         ? 'layui-upload-drag-disable' | ||||
|         : isDragEnter | ||||
|           ? 'layui-upload-drag-draging' | ||||
|           : '' | ||||
|       ? 'layui-upload-drag-disable' | ||||
|       : isDragEnter | ||||
|         ? 'layui-upload-drag-draging' | ||||
|         : '' | ||||
|       " @click.stop="chooseFile"> | ||||
|       <i class="layui-icon"></i> | ||||
|       <p>{{ dragText }}</p> | ||||
|  | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user