hookehuyr

fix 视频16:9比例根据页面width动态判断

......@@ -121,6 +121,10 @@ export default {
_this.detail.showStatus = true;
});
}, 500);
// 配置16:9高度比
const width = document.getElementById('mui-player-' + this.item.id).clientWidth;
const height = (width * 9) / 16;
document.getElementById('mui-player-' + this.item.id).height = height;
},
methods: {
goTo () { // 跳转作品详情页
......@@ -162,7 +166,6 @@ export default {
.video-div {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
height: 13rem !important;
}
.video-bar {
......
......@@ -62,6 +62,10 @@ onMounted(() => {
props: props.item,
});
});
// 配置16:9高度比
const width = document.getElementById('mui-player-' + props.item.id).clientWidth;
const height = (width * 9) / 16;
document.getElementById('mui-player-' + props.item.id).height = height;
});
</script>
......@@ -76,7 +80,6 @@ onMounted(() => {
.video-div {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
height: 13rem !important;
}
.video-bar {
......
......@@ -106,6 +106,10 @@ onMounted(() => {
video && video.addEventListener('play', function () {
handleAction('play', props.item.id)
});
// 配置16:9高度比
const width = document.getElementById('mui-player-' + props.item.id).clientWidth;
const height = (width * 9) / 16;
document.getElementById('mui-player-' + props.item.id).height = height;
});
const goTo = () => { // 跳转作品详情页
......@@ -143,7 +147,6 @@ const setComment = () => {
.video-div {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
height: 13rem !important;
}
.video-bar {
......
......@@ -91,6 +91,10 @@ export default {
_this.handleAction('play', _this.item.id)
});
}, 500)
// 配置16:9高度比
const width = document.getElementById('mui-player-' + this.item.id).clientWidth;
const height = (width * 9) / 16;
document.getElementById('mui-player-' + this.item.id).height = height;
},
methods: {
}
......@@ -99,6 +103,10 @@ export default {
<style lang="less" scoped>
.video-wrapper {
.video-div {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.video-bar {
color: #713610;
padding: 1rem;
......