problem description
the picture needs to be scaled proportionally,
the environmental background of the problems and what methods you have tried
I have tried to operate within the @ load function, but the effect is not satisfactory
related codes
/ / Please paste the code text below (do not replace the code with pictures)
< template >
<image :src="val.primary_pic_url" :ref=""limg"+i" @load="leftimg(i,$event)" class="img" ></template>
< / html >
< script >
leftimg (iMagne event) {
var that=this;
const view = that.$refs["limg"+i];
if(view[0].ref == event.target.ref){
if(WXEnvironment.platform != "Web"){
// that.msg=view;
// this.msg1=event;
// 365px
var rqwidth=365;
var width=event.size.naturalWidth,height=event.size.naturalHeight;
var ratio = rqwidth/width;
// that.msg=ratio;
width = ratio*width;
height = ratio*height;
this.testh=height;
this.testw=width;
animation.transition(view,{
styles:{
width: width+"px",
height: height+"px"
},
duration: 0,
timingFunction: "ease",
delay: 0,
needLayout:true
}, function(){})
}
}
},
< / script >