diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 4d20923..45a07b7 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -71,6 +71,11 @@ export default { type: Boolean, default: true, }, + // 是否获取图片宽高 + isGetPicInfo: { + type: Boolean, + default: false, + }, }, data() { return { @@ -164,6 +169,27 @@ export default { return false; } } + if (this.isGetPicInfo) { + const isSize = new Promise((resolve, reject) => { + //上传文件为图片类型 + let img = new Image(); + img.onload = function () { + resolve(img); + }; + img.src = URL.createObjectURL(file); + }).then( + (res) => { + let picInfo = { + width: res.width, + height: res.height, + }; + this.$emit("getPicInfo", picInfo); + }, + (err) => { + return Promise.reject(); + } + ); + } this.loading = this.$loading({ lock: true, text: "上传中", diff --git a/src/views/vehicleMent/map.vue b/src/views/vehicleMent/map.vue index 9a0f965..c5f2638 100644 --- a/src/views/vehicleMent/map.vue +++ b/src/views/vehicleMent/map.vue @@ -12,14 +12,20 @@ px/m - + - + { this.dataInfo = response.rows[0] || {}; }); }, + getPicInfo(e) { + this.dataInfo.xpixel = e.width; + this.dataInfo.ypixel = e.height; + }, /** 提交按钮 */ submitForm() { this.$refs["form"].validate((valid) => { diff --git a/src/views/vehicleMent/overview.vue b/src/views/vehicleMent/overview.vue index 4a82792..7141a4a 100644 --- a/src/views/vehicleMent/overview.vue +++ b/src/views/vehicleMent/overview.vue @@ -1,11 +1,8 @@