首页 > 其他分享 >screenfull ==vue全屏功能

screenfull ==vue全屏功能

时间:2023-02-11 17:33:13浏览次数:45  
标签:vue isEnabled destroyscreen 全屏 changescreen screenfull message

1. import screenfull from 'screenfull'
 
mounted(){
        this.screeninit()
   
    },
    beforeDestroy() {
        this.destroyscreen()
    },
 
 
// 处理全屏
        clickscreen() {
            if (!screenfull.isEnabled) {
                this.$message({ message: '你的浏览器不支持全屏', type: 'warning' })
                return false
            }
            var a = document.getElementById('bigScreen')
            screenfull.toggle(a)
        },
        changescreen() {
            this.isFullscreen = screenfull.isFullscreen
        },
        screeninit() {
            if (screenfull.isEnabled) {
                screenfull.on('change', this.changescreen)
            }
        },
        destroyscreen() {
            if (screenfull.isEnabled) {
                screenfull.off('change', this.changescreen)
            }
        },

 

标签:vue,isEnabled,destroyscreen,全屏,changescreen,screenfull,message
From: https://www.cnblogs.com/panshuilong/p/17112179.html

相关文章