|
@@ -183,11 +183,14 @@
|
|
|
style="text-align: center"
|
|
|
>
|
|
|
<el-image
|
|
|
- :width="itemI.width"
|
|
|
- :height="itemI.height"
|
|
|
:src="itemI.src"
|
|
|
fit="contain"
|
|
|
+ :style="{
|
|
|
+ width: itemI.width + 'px',
|
|
|
+ height: itemI.height + 'px',
|
|
|
+ }"
|
|
|
:preview-src-list="[itemI.src]"
|
|
|
+ @load="handleImageLoad($event, itemI)"
|
|
|
></el-image>
|
|
|
</figure>
|
|
|
</template>
|
|
@@ -729,11 +732,14 @@
|
|
|
style="text-align: center"
|
|
|
>
|
|
|
<el-image
|
|
|
- :width="itemI.width"
|
|
|
- :height="itemI.height"
|
|
|
:src="itemI.src"
|
|
|
fit="contain"
|
|
|
+ :style="{
|
|
|
+ width: itemI.width + 'px',
|
|
|
+ height: itemI.height + 'px',
|
|
|
+ }"
|
|
|
:preview-src-list="[itemI.src]"
|
|
|
+ @load="handleImageLoad($event, itemI)"
|
|
|
></el-image>
|
|
|
</figure>
|
|
|
</template>
|
|
@@ -1634,6 +1640,18 @@ export default {
|
|
|
items.indexOf("width: ") + indexW + 7
|
|
|
)
|
|
|
: null,
|
|
|
+ height:
|
|
|
+ items.indexOf('height="') > -1
|
|
|
+ ? items.substring(
|
|
|
+ items.indexOf('height="') + 8,
|
|
|
+ items.indexOf('height="') + indexH + 8
|
|
|
+ )
|
|
|
+ : items.indexOf("height: ") > -1
|
|
|
+ ? items.substring(
|
|
|
+ items.indexOf("height: ") + 8,
|
|
|
+ items.indexOf('height="') + indexH + 8
|
|
|
+ )
|
|
|
+ : null,
|
|
|
};
|
|
|
imgArr.push(imgobj);
|
|
|
}
|
|
@@ -1754,6 +1772,14 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ handleImageLoad(event, item) {
|
|
|
+ if (!item.width) {
|
|
|
+ item.width = event.target.naturalWidth;
|
|
|
+ }
|
|
|
+ if (!item.height) {
|
|
|
+ item.height = event.target.naturalHeight;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.articleInfo) {
|