mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-27 01:32:10 +08:00 
			
		
		
		
	* fix(Uploader): preview is slow when sum of images size be bigger(#7307) * Update index.js Co-authored-by: neverland <chenjiahan@buaa.edu.cn>
This commit is contained in:
		
							parent
							
								
									b59f58e951
								
							
						
					
					
						commit
						3e71c4a224
					
				| @ -93,6 +93,14 @@ export default createComponent({ | |||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|  |   created() { | ||||||
|  |     this.urls = []; | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|  |   beforeDestroy() { | ||||||
|  |     this.urls.forEach((url) => URL.revokeObjectURL(url)); | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|   methods: { |   methods: { | ||||||
|     getDetail(index = this.fileList.length) { |     getDetail(index = this.fileList.length) { | ||||||
|       return { |       return { | ||||||
| @ -259,7 +267,13 @@ export default createComponent({ | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       const imageFiles = this.fileList.filter((item) => isImageFile(item)); |       const imageFiles = this.fileList.filter((item) => isImageFile(item)); | ||||||
|       const imageContents = imageFiles.map((item) => item.content || item.url); |       const imageContents = imageFiles.map((item) => { | ||||||
|  |         if (item.file && !item.url) { | ||||||
|  |           item.url = URL.createObjectURL(item.file); | ||||||
|  |           this.urls.push(item.url); | ||||||
|  |         } | ||||||
|  |         return item.url; | ||||||
|  |       }); | ||||||
| 
 | 
 | ||||||
|       this.imagePreview = ImagePreview({ |       this.imagePreview = ImagePreview({ | ||||||
|         images: imageContents, |         images: imageContents, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user