From e1467b19874294a9a36dcfb06083081f9d4b504d Mon Sep 17 00:00:00 2001 From: hanbaoshan <hanbaoshan@aiotlink.com> Date: 星期四, 05 十一月 2020 11:32:16 +0800 Subject: [PATCH] 上传组件回复至三方原始包,数据栈根据文件夹动态传入资源类型;联动刷新底图修复 --- src/components/subComponents/FileUpload/uploader.vue | 80 ++++++++++----------------------------- 1 files changed, 21 insertions(+), 59 deletions(-) diff --git a/src/components/subComponents/FileUpload/uploader.vue b/src/components/subComponents/FileUpload/uploader.vue index fafa33e..6ada9f3 100644 --- a/src/components/subComponents/FileUpload/uploader.vue +++ b/src/components/subComponents/FileUpload/uploader.vue @@ -14,9 +14,7 @@ </template> <script> -//import Uploader from 'simple-uploader.js' -//require('./common/uploader-simple') -import './common/uploader-simple' +import Uploader from 'simple-uploader.js' import { kebabCase } from './common/utils' import UploaderBtn from './btn.vue' import UploaderDrop from './drop.vue' @@ -34,19 +32,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: { @@ -134,54 +119,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(); - }, + 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 + //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 }, components: { UploaderBtn, -- Gitblit v1.8.0