| | |
| | | disabled: { type: Boolean, default: false }, |
| | | round: { type: Boolean, default: false }, |
| | | onSuccess: { type: Function, default: () => { return true } }, |
| | | |
| | | host: {type: String, default: ''}, |
| | | cropper: { type: Boolean, default: false }, |
| | | compress: {type: Number, default: 1}, |
| | | aspectRatio: {type: Number, default: NaN} |
| | |
| | | height: this.height + "px" |
| | | }, |
| | | cropperDialogVisible: false, |
| | | cropperFile: null |
| | | cropperFile: null, |
| | | hostNew: '' |
| | | } |
| | | }, |
| | | watch:{ |
| | |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.value = this.modelValue |
| | | this.newFile(this.modelValue) |
| | | this.getHost().then(res => { |
| | | this.value = this.modelValue |
| | | this.newFile(this.modelValue) |
| | | }) |
| | | }, |
| | | methods: { |
| | | getHost () { |
| | | if (this.host) return this.hostNew = this.host |
| | | return this.$API.setting.component.getImgHost.get().then(res => { |
| | | this.hostNew = res.data + '/visual/' |
| | | }) |
| | | }, |
| | | newFile(url){ |
| | | if(url){ |
| | | this.file = { |
| | | status: "success", |
| | | url: url |
| | | url: `${this.hostNew}${url}` |
| | | } |
| | | }else{ |
| | | this.file = null |
| | |
| | | success(res, file){ |
| | | //释放内存删除blob |
| | | URL.revokeObjectURL(file.tempFile) |
| | | delete file.tempFile |
| | | try { |
| | | delete file.tempFile |
| | | } catch (error) { |
| | | |
| | | } |
| | | var os = this.onSuccess(res, file) |
| | | if(os!=undefined && os==false){ |
| | | this.$nextTick(() => { |