全屏状态无法监听到Esc按键事件
Vue页面全屏以后,按下键盘Esc按键时,无法监听到Esc的按键事件,解决方案:methods: {checkFull(){var isFull = document.fullscreenEnabled || window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabledif(isF...
·
Vue页面全屏以后,按下键盘Esc按键时,无法监听到Esc的按键事件,解决方案:
methods: {
checkFull(){
var isFull = document.fullscreenEnabled || window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled
if(isFull === undefined) isFull = false;
return isFull;
}
},
created(){
let that = this
window.onresize = function(){
if(!that.checkFull()){
// 退出全屏后要执行的动作
that.$emit('Fullscreen',false)
}
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)