diff --git a/package.json b/package.json index 5b283220..7a17a7a8 100755 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "particles.js": "^2.0.0", "path-posix": "^1.0.0", "quill": "^1.3.4", + "screenfull": "^3.3.2", "simplemde": "^1.11.2", "v-charts": "^1.17.6", "v-contextmenu": "^2.7.0", diff --git a/src/libs/util.js b/src/libs/util.js index 959ed886..867e6bbf 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -25,37 +25,6 @@ util.title = function (title) { window.document.title = `${prefix}${title ? ` | ${title}` : ''}` } -/** - * @description 打开全屏 - */ -util.openFullScreen = function () { - const body = document.body - if (body.requestFullscreen) { - body.requestFullscreen() - } else if (body.mozRequestFullScreen) { - body.mozRequestFullScreen() - } else if (body.webkitRequestFullScreen) { - body.webkitRequestFullScreen() - } else if (body.msRequestFullscreen) { - body.msRequestFullscreen() - } -} - -/** - * @description 关闭全屏 - */ -util.exitFullScreen = function () { - if (document.exitFullscreen) { - document.exitFullscreen() - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen() - } else if (document.webkitCancelFullScreen) { - document.webkitCancelFullScreen() - } else if (document.msExitFullscreen) { - document.msExitFullscreen() - } -} - /** * @description 在每次打开新页面的时候调用 打开一个新的 tab * @param {object} vm vue diff --git a/src/main.js b/src/main.js index c26f5080..c0bda36a 100755 --- a/src/main.js +++ b/src/main.js @@ -38,6 +38,9 @@ import '@/assets/icons/index' // markdown主题 import 'github-markdown-css' +// 全屏控制 +import screenfull from 'screenfull' + // 代码高亮主题 import '@/assets/library/highlight/styles/atom-one-light.css' @@ -110,6 +113,14 @@ new Vue({ this.$store.commit('d2adminPageOpenedListLoad') // D2Admin 开发环境检查更新 util.checkUpdate(this) + // 检测退出全屏 + if (screenfull.enabled) { + screenfull.on('change', () => { + if (!screenfull.isFullscreen) { + this.$store.commit('d2adminFullScreenSet', false) + } + }) + } }, methods: { /** diff --git a/src/store/modules/d2admin.js.REMOVED.git-id b/src/store/modules/d2admin.js.REMOVED.git-id index cdcef160..cb5e761c 100644 --- a/src/store/modules/d2admin.js.REMOVED.git-id +++ b/src/store/modules/d2admin.js.REMOVED.git-id @@ -1 +1 @@ -151df8419f384f17f5ccd7a9df8cb5dd16e8c255 \ No newline at end of file +0c08503962c63595a288af254074e6dc5f7d22a6 \ No newline at end of file