FullScreenBtn.vue 730 B

12345678910111213141516171819202122232425262728293031
  1. <template>
  2. <a @click='clickFullscreen' style="text-align:center;padding-left:2px;" title="点击切换全屏">
  3. <img src="/assets/images/sys/full.png" width="30px" class="nozoom" />
  4. <span style="color:gray;font-size:11px;font-weight:400;">全屏看</span>
  5. </a>
  6. </template>
  7. <script>
  8. import screenfull from 'screenfull'
  9. export default{
  10. name: 'FullScreenBtn',
  11. data(){
  12. return {
  13. isFullscreen: false
  14. }
  15. },
  16. methods:{
  17. clickFullscreen(){
  18. if (!screenfull.isEnabled) {
  19. this.$message({
  20. message: 'you browser can not work',
  21. type: 'warning'
  22. })
  23. return false
  24. }
  25. screenfull.toggle()
  26. }
  27. }
  28. }
  29. </script>