1.全屏
注:全屏整页 const el = document.documentElement;
,指定某个盒子全屏const el = document.getElementById('boxId');
handleFullScreen = () => {
const el = document.getElementById('boxId');
const rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
if (typeof rfs !== 'undefined' && rfs) {
rfs.call(el);
}
};
2.退出全屏
handleFullScreenExit = () => {
const cfs = document.cancelFullScreen || document.webkitCancelFullScreen || document.mozCancelFullScreen || document.exitFullScreen;
if (typeof cfs !== 'undefined' && cfs) {
cfs.call(document);
}
};