problem description
v-html limits the width of the img in the html content. Does the onload of the picture need to generate new Image () one by one
the original way of writing can only change the first one
mounted: function () {
this.$nextTick(function () {
var Img = new Image();
var imgs = $("-sharpinfoContent p img");
imgs.each(function (i, v) {
Img.src = v.src;
Img.onload = function() {
if ($(v).width() > 630) {
$(v).css("width", "100%");
}
}
})
})
}
changed
mounted: function () {
this.$nextTick(function () {
var imgs = $("-sharpinfoContent p img"), Img = [];
imgs.each(function (i, v) {
Img[i] = new Image();
Img[i].src = v.src;
Img[i].onload = function() {
if ($(v).width() > 630) {
$(v).css("width", "100%");
}
}
})
})
}