为何建设银行网站无法登陆,扬中富裕吗,柳江企业网站建设公司,wordpress自建邮箱因为image组件默认是有宽度跟高度的#xff0c;所以这个高度不怎么好写 通过load事件来控制图片的高度 话不多说#xff0c;直接上代码#xff0c;
image classimg src/static/image.png :style{ height: imgHeight px }mode所以这个高度不怎么好写 通过load事件来控制图片的高度 话不多说直接上代码
image classimg src/static/image.png :style{ height: imgHeight px }modewidthFix loadonImgLoad
/image
data() {return {imgHeight: 0}
},
methods: {onImgLoad(e) {// 当图片加载完成后获取图片的原始宽度和高度并根据宽度计算出高度const { width, height } e.mp.detail;this.imgHeight (height / width) * 100; // 高度 原始高度 / 原始宽度 * 100},
},
.img{width: 100%;
}
随手一记~