fix[Screenfull]: fix screenfull bug (#1603)

This commit is contained in:
花裤衩 2019-02-15 10:03:34 +08:00 committed by GitHub
parent 9ed5db044f
commit 8c18c000d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -14,6 +14,9 @@ export default {
isFullscreen: false isFullscreen: false
} }
}, },
mounted() {
this.init()
},
methods: { methods: {
click() { click() {
if (!screenfull.enabled) { if (!screenfull.enabled) {
@ -23,12 +26,17 @@ export default {
}) })
return false return false
} }
screenfull.toggle().then(() => { screenfull.toggle()
},
init() {
if (screenfull.enabled) {
screenfull.on('change', () => {
this.isFullscreen = screenfull.isFullscreen this.isFullscreen = screenfull.isFullscreen
}) })
} }
} }
} }
}
</script> </script>
<style scoped> <style scoped>