From 4a800a8fc83c6bd1f86a8e847b079a51a7532c09 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期三, 20 七月 2022 15:05:58 +0800 Subject: [PATCH] 修复国标配置的bug --- src/components/subComponents/FileUpload/uploader.vue | 82 ++++++++++++----------------------------- 1 files changed, 24 insertions(+), 58 deletions(-) diff --git a/src/components/subComponents/FileUpload/uploader.vue b/src/components/subComponents/FileUpload/uploader.vue index ddcedb9..14735e4 100644 --- a/src/components/subComponents/FileUpload/uploader.vue +++ b/src/components/subComponents/FileUpload/uploader.vue @@ -3,11 +3,12 @@ <!-- <div class="close" @click="closeHandle">x</div> --> <slot :files="files" :file-list="fileList" :started="started"> <uploader-unsupport></uploader-unsupport> - <uploader-drop> - <!-- <p>鎷栧姩鏂囦欢鍒拌鍖哄煙涓婁紶</p> --> + <UploaderDrop> + <p>鎷栧姩鏂囦欢鍒拌鍖哄煙涓婁紶</p> + <uploader-btn >閫夋嫨鏂囦欢</uploader-btn> <uploader-btn :directory="true" >閫夋嫨鏂囦欢澶�</uploader-btn> - </uploader-drop> + </UploaderDrop> <uploader-list></uploader-list> </slot> </div> @@ -32,19 +33,6 @@ return { uploader: this } - }, - watch:{ - attrs:{ - handler(n,o){ - console.log('uploader attrs update',n) - //this.$nextTick(()=>{ - this.unBindUploader(); - this.bindUploader(); - //}) - }, - deep: true - }, - }, props: { attrs: { @@ -132,54 +120,31 @@ }, closeHandle() { this.$emit("close") - }, - bindUploader(){ - console.log('new Uploader') - this.options.initialPaused = !this.autoStart - const uploader = new Uploader(this.options) - this.uploader = uploader - this.uploader.fileStatusText = this.fileStatusText - uploader.on('catchAll', this.allEvent) - uploader.on(FILE_ADDED_EVENT, this.fileAdded) - uploader.on(FILES_ADDED_EVENT, this.filesAdded) - uploader.on('fileRemoved', this.fileRemoved) - uploader.on('filesSubmitted', this.filesSubmitted) - }, - unBindUploader(){ - const uploader = this.uploader - uploader.off('catchAll', this.allEvent) - uploader.off(FILE_ADDED_EVENT, this.fileAdded) - uploader.off(FILES_ADDED_EVENT, this.filesAdded) - uploader.off('fileRemoved', this.fileRemoved) - uploader.off('filesSubmitted', this.filesSubmitted) - this.uploader = null } }, created() { - console.log('uploader attrs',this.attrs); - this.bindUploader(); - // this.options.initialPaused = !this.autoStart - // const uploader = new Uploader(this.options) - // this.uploader = uploader - // this.uploader.fileStatusText = this.fileStatusText - // uploader.on('catchAll', this.allEvent) - // uploader.on(FILE_ADDED_EVENT, this.fileAdded) - // uploader.on(FILES_ADDED_EVENT, this.filesAdded) - // uploader.on('fileRemoved', this.fileRemoved) - // uploader.on('filesSubmitted', this.filesSubmitted) + // console.log('uploader attrs',this.attrs); + // this.bindUploader(); + this.options.initialPaused = !this.autoStart + const uploader = new Uploader(this.options) + this.uploader = uploader + this.uploader.fileStatusText = this.fileStatusText + uploader.on('catchAll', this.allEvent) + uploader.on(FILE_ADDED_EVENT, this.fileAdded) + uploader.on(FILES_ADDED_EVENT, this.filesAdded) + uploader.on('fileRemoved', this.fileRemoved) + uploader.on('filesSubmitted', this.filesSubmitted) }, - mounted(){ - //this.bindUploader(); + mounted() { }, destroyed() { - this.unBindUploader(); - // const uploader = this.uploader - // uploader.off('catchAll', this.allEvent) - // uploader.off(FILE_ADDED_EVENT, this.fileAdded) - // uploader.off(FILES_ADDED_EVENT, this.filesAdded) - // uploader.off('fileRemoved', this.fileRemoved) - // uploader.off('filesSubmitted', this.filesSubmitted) - // this.uploader = null + const uploader = this.uploader + uploader.off('catchAll', this.allEvent) + uploader.off(FILE_ADDED_EVENT, this.fileAdded) + uploader.off(FILES_ADDED_EVENT, this.filesAdded) + uploader.off('fileRemoved', this.fileRemoved) + uploader.off('filesSubmitted', this.filesSubmitted) + this.uploader = null }, components: { UploaderBtn, @@ -199,4 +164,5 @@ cursor: pointer; } } + </style> -- Gitblit v1.8.0