You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1023 B
60 lines
1023 B
<template>
|
|
<div>
|
|
<svg-icon
|
|
:icon-class="isFullscreen?'svg_exitFullscreen':'svg_fullscreen'"
|
|
@click="click"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import screenfull from 'screenfull'
|
|
|
|
export default {
|
|
name: 'Screenfull',
|
|
data () {
|
|
return {
|
|
isFullscreen: false
|
|
}
|
|
},
|
|
mounted () {
|
|
this.init()
|
|
},
|
|
beforeDestroy () {
|
|
this.destroy()
|
|
},
|
|
methods: {
|
|
click () {
|
|
if (!screenfull.enabled) {
|
|
this.$warningMsg('you browser can not work')
|
|
return false
|
|
}
|
|
screenfull.toggle()
|
|
},
|
|
change () {
|
|
this.isFullscreen = screenfull.isFullscreen
|
|
},
|
|
init () {
|
|
if (screenfull.enabled) {
|
|
screenfull.on('change', this.change)
|
|
}
|
|
},
|
|
destroy () {
|
|
if (screenfull.enabled) {
|
|
screenfull.off('change', this.change)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.screenfull-svg {
|
|
display: inline-block;
|
|
cursor: pointer;
|
|
fill: #5a5e66;
|
|
width: 20px;
|
|
height: 20px;
|
|
vertical-align: 10px;
|
|
}
|
|
</style>
|
|
|