浏览器全屏实现方式
- 利用h5的requestFullScreen()实现
- 按esc退出全屏效果
// 如果想单击实现全屏的话,直接用@click点击事件
<div @dblclick="openFullscreen" id="fullscreen">
// do something...
</div>
mounted() {
this.openFullscreen()
},
methods:{
var elem = document.getElementById('fullscreen')
if (elem.requestFullscreen) {
elem.requestFullscreen()
} else if (elem.mozRequestFullScreen) { /* Firefox */
elem.mozRequestFullScreen()
} else if (elem.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
elem.webkitRequestFullscreen()
} else if (elem.msRequestFullscreen) { /* IE/Edge */
elem.msRequestFullscreen()
}
},
}