方法一:
(1) html中:
-
<div class="videoMa" ref="videoMa" style="width:100%;height:100%;">
-
<div id="playWnd" class="playWnd" :style="{width:videoBox.width+ 'px',height:videoBox.height+ 'px'}"></div>
-
</div>
(2) data中:
-
videoBox:{
-
width:800,
-
height:500,
-
}
(3)mounted中:
-
mounted() {
-
this.videoBox.width=this.$refs.videoMa.offsetWidth;
-
this.videoBox.height=this.$refs.videoMa.offsetHeight;
-
}