| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <template>  <div>    <svg-icon class-name="icon" :icon-class="isFullscreen ? 'exit-fullscreen' : '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() {      console.log(screenfull)      if (!screenfull.isEnabled) {        this.$message({          message: 'you browser can not work',          type: 'warning'        })        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>.icon {	cursor: pointer;	font-size: 12px;	vertical-align: middle;}.screenfull-svg {	display: inline-block;	cursor: pointer;	fill: #5a5e66;	;	width: 20px;	height: 20px;	vertical-align: 10px;}</style>
 |