Rap 原分销系统代码Web
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.

61 line
1.0KB

  1. <template>
  2. <div>
  3. <svg-icon :icon-class="isFullscreen?'exit-fullscreen':'fullscreen'" @click="click" />
  4. </div>
  5. </template>
  6. <script>
  7. import screenfull from 'screenfull'
  8. export default {
  9. name: 'Screenfull',
  10. data() {
  11. return {
  12. isFullscreen: false
  13. }
  14. },
  15. mounted() {
  16. this.init()
  17. },
  18. beforeDestroy() {
  19. this.destroy()
  20. },
  21. methods: {
  22. click() {
  23. if (!screenfull.enabled) {
  24. this.$message({
  25. message: 'you browser can not work',
  26. type: 'warning'
  27. })
  28. return false
  29. }
  30. screenfull.toggle()
  31. },
  32. change() {
  33. this.isFullscreen = screenfull.isFullscreen
  34. },
  35. init() {
  36. if (screenfull.enabled) {
  37. screenfull.on('change', this.change)
  38. }
  39. },
  40. destroy() {
  41. if (screenfull.enabled) {
  42. screenfull.off('change', this.change)
  43. }
  44. }
  45. }
  46. }
  47. </script>
  48. <style scoped>
  49. .screenfull-svg {
  50. display: inline-block;
  51. cursor: pointer;
  52. fill: #5a5e66;;
  53. width: 20px;
  54. height: 20px;
  55. vertical-align: 10px;
  56. }
  57. </style>