From e0991da9cf6199842c9647c4d4c03f8fd21e78b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Fri, 15 Feb 2019 10:03:34 +0800 Subject: [PATCH] fix[Screenfull]: fix screenfull bug (#1603) --- src/components/Screenfull/index.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 8e7bcba4..479bf3e3 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -14,6 +14,9 @@ export default { isFullscreen: false } }, + mounted() { + this.init() + }, methods: { click() { if (!screenfull.enabled) { @@ -23,9 +26,14 @@ export default { }) return false } - screenfull.toggle().then(() => { - this.isFullscreen = screenfull.isFullscreen - }) + screenfull.toggle() + }, + init() { + if (screenfull.enabled) { + screenfull.on('change', () => { + this.isFullscreen = screenfull.isFullscreen + }) + } } } }