因为image组件默认是有宽度跟高度的,所以这个高度不怎么好写
通过@load事件来控制图片的高度
话不多说,直接上代码,
data() {
return {
imgHeight: 0
}
},
methods: {
服务器托管网 onImgLoad(e) {
// 当图片加载完成后,获取图片的原始宽度和高度,并根据宽度计算出高度
const { width, height } = e.mp.detail;
this.imgHeight = (he服务器托管网ight / width) * 100; // 高度 = 原始高度 / 原始宽度 * 100
},
},
.img{
width: 100%;
}
随手一记~
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: 一个SPS + K2 + InfoPath + Mobile + Exchange的工作流程演示系统
一个SPS + K2 + InfoPath + Mobile + Exchange的工作流程演示系统 发表于:2007年12月19日 22时38分15秒阅读(9)评论(2)特效 一个SPS + K2 + InfoPath + Mobile + Exchange…