| | |
| | | <template> |
| | | <div class="zt-upload"> |
| | | <div class="zt-upload" :class="[{'lineHeight':lineHeight}]"> |
| | | <!-- 文件上传 --> |
| | | <el-upload |
| | | ref="upload" |
| | |
| | | </el-upload> |
| | | <br/> |
| | | <div v-show="progressFlag"> |
| | | <el-progress :text-inside="true" :stroke-width="30" :percentage="progressPercent" :format="format"></el-progress> |
| | | <el-progress :text-inside="true" :stroke-width="10" :percentage="progressPercent" :format="format"></el-progress> |
| | | </div> |
| | | |
| | | <ul class="el-upload-list el-upload-list--text" v-if="!image && !crop && !onlyUploadFile"> |
| | |
| | | } |
| | | }, |
| | | dataForm: Object, |
| | | lineHeight:{ |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | action: { |
| | | type: String, |
| | | default: '/sys/oss/uploadNew' |
| | |
| | | inject: { |
| | | elForm: { |
| | | default: '' |
| | | } |
| | | }, |
| | | }}, |
| | | data() { |
| | | return { |
| | | isUpload: false, |
| | |
| | | src: this.value.url, |
| | | title: this.value.name |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | return urls |
| | | }, |
| | |
| | | watch: { |
| | | // eslint-disable-next-line no-unused-vars |
| | | value(val, oldval) { |
| | | console.log(val,'zt-upload value(val') |
| | | if (this.uploadList !== val) { |
| | | this.uploadList = this.getUploadList(val) |
| | | this.fileList = this.getUploadList(val) |
| | |
| | | if (val) { |
| | | if (val.length > 0) { |
| | | if (!this.multiple) { // 单选 |
| | | console.log(val, 'getUploadList val') |
| | | return val |
| | | } else { |
| | | console.log([...val], 'getUploadList [...val]') |
| | | return [...val] |
| | | } |
| | | } else { |
| | |
| | | if (this.crop && this.$refs.cropper) { |
| | | document.body.appendChild(this.$refs.cropper.$el) |
| | | } |
| | | if (this.value) { |
| | | console.log(this.value,'zt-upload value(val') |
| | | this.uploadList = this.getUploadList(this.value) |
| | | this.fileList = this.getUploadList(this.value) |
| | | if (this.fileList.length>0){ |
| | | console.log(this.fileList[0].status, 'val.files[0].status23') |
| | | // alert('2222'+this.fileList[0].status) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | .zt-upload { |
| | | line-height: 1; |
| | | } |
| | | |
| | | .zt-upload.lineHeight{ |
| | | line-height: 0; |
| | | } |
| | | .zt .upload-input .upload-btn { |
| | | padding: 8px 12px; |
| | | } |