网页退出全屏和全屏显示

<div @click="fullScreen">全屏显示</div>
<div @click="exitFullScreen">退出全屏</div>
fullScreen () {
            var de = document.documentElement;
            if (de.requestFullscreen) {
                de.requestFullscreen();
            } else if (de.mozRequestFullScreen) {
                de.mozRequestFullScreen();
            } else if (de.webkitRequestFullScreen) {
                de.webkitRequestFullScreen();
            } else if (de.msRequestFullscreen) {
                de.msRequestFullscreen();
            }
},
exitFullScreen () {
            var de = document;
            if (de.exitFullscreen) {
                de.exitFullscreen();
            } else if (de.mozCancelFullScreen) {
                de.mozCancelFullScreen();
            } else if (de.webkitCancelFullScreen) {
                de.webkitCancelFullScreen();
            } else if (document.msExitFullscreen) {
                document.msExitFullscreen();
            }
}

 

posted @ 2024-04-25 10:38  eternityQSL  阅读(9)  评论(0编辑  收藏  举报