Browse Source

Merge pull request #452 from hotcoffie/wvp-28181-2.0

优化播放器尺寸调节逻辑:
pull/457/head
648540858 3 years ago
committed by GitHub
parent
commit
62f5b3dfdd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      web_src/src/components/common/jessibuca.vue

13
web_src/src/components/common/jessibuca.vue

@ -1,5 +1,5 @@
<template> <template>
<div id="container" ref="containerId" @dblclick="fullscreenSwich" style="width: 100%"> <div id="container" ref="containerId" @dblclick="fullscreenSwich" style="background-color: #eee;margin:0 auto;">
<div class="buttons-box" id="buttonsBox"> <div class="buttons-box" id="buttonsBox">
<div class="buttons-box-left"> <div class="buttons-box-left">
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i>
@ -72,9 +72,16 @@ export default {
methods: { methods: {
updatePlayerDomSize() { updatePlayerDomSize() {
let dom = document.getElementById('container'); let dom = document.getElementById('container');
const width = dom.parentNode.clientWidth let width = dom.parentNode.clientWidth
let height = (9 / 16) * width
const clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight)
if (height > clientHeight) {
height = clientHeight
width = (16 / 9) * height
}
dom.style.width = width + 'px'; dom.style.width = width + 'px';
dom.style.height = (9 / 16) * width + "px"; dom.style.height = height + "px";
}, },
create() { create() {
let options = {}; let options = {};

Loading…
Cancel
Save