<video bindloadedmetadata="getProportion"
style="width:100%;height: {{proportion * 100 +'%'}};"
show-fullscreen-btn='{{false}}'
show-play-btn='{{false}}'
show-bottom-progress='{{false}}'
controls='{{false}}'
muted='{{true}}'
loop autoplay src="{{item.src}}"/>
bindloadedmetadata:视频元素加载完成时触发。
getProportion (e) {
var that = this;
var height = e.detail.height;
//视频的宽
var width = e.detail.width;
//算出视频的比例
var proportion = height / width ;
that.setData({
proportion
});
},