Commit bb5e0f2ce5d756c595ca000105943a5214ef32b9
1 parent
f58839aa
add 全屏功能
Showing
2 changed files
with
41 additions
and
1 deletions
src/assets/img/righttopbarico_Bg.png
0 → 100644
945 Bytes
src/components/headerCommon.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="headercommon"> | 2 | <div class="headercommon"> |
| 3 | <h3>丹阳停车运营监控中心</h3> | 3 | <h3>丹阳停车运营监控中心</h3> |
| 4 | + <div class="header-fullscreen" @click="handleFullScreen"></div> | ||
| 4 | <div class="time-wrap"> | 5 | <div class="time-wrap"> |
| 5 | <p>{{timedate}}</p> | 6 | <p>{{timedate}}</p> |
| 6 | <p>{{time}}</p> | 7 | <p>{{time}}</p> |
| @@ -17,8 +18,37 @@ export default { | @@ -17,8 +18,37 @@ export default { | ||
| 17 | data() { | 18 | data() { |
| 18 | return { | 19 | return { |
| 19 | timedate: getNowFormatDate(), | 20 | timedate: getNowFormatDate(), |
| 20 | - time: getNowFormatTime() | 21 | + time: getNowFormatTime(), |
| 22 | + fullscreen: false | ||
| 21 | } | 23 | } |
| 24 | + }, | ||
| 25 | + methods:{ | ||
| 26 | + handleFullScreen(){ | ||
| 27 | + let element = document.documentElement; | ||
| 28 | + if (this.fullscreen) { | ||
| 29 | + if (document.exitFullscreen) { | ||
| 30 | + document.exitFullscreen(); | ||
| 31 | + } else if (document.webkitCancelFullScreen) { | ||
| 32 | + document.webkitCancelFullScreen(); | ||
| 33 | + } else if (document.mozCancelFullScreen) { | ||
| 34 | + document.mozCancelFullScreen(); | ||
| 35 | + } else if (document.msExitFullscreen) { | ||
| 36 | + document.msExitFullscreen(); | ||
| 37 | + } | ||
| 38 | + } else { | ||
| 39 | + if (element.requestFullscreen) { | ||
| 40 | + element.requestFullscreen(); | ||
| 41 | + } else if (element.webkitRequestFullScreen) { | ||
| 42 | + element.webkitRequestFullScreen(); | ||
| 43 | + } else if (element.mozRequestFullScreen) { | ||
| 44 | + element.mozRequestFullScreen(); | ||
| 45 | + } else if (element.msRequestFullscreen) { | ||
| 46 | + // IE11 | ||
| 47 | + element.msRequestFullscreen(); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + this.fullscreen = !this.fullscreen; | ||
| 51 | + }, | ||
| 22 | } | 52 | } |
| 23 | } | 53 | } |
| 24 | </script> | 54 | </script> |
| @@ -42,6 +72,16 @@ export default { | @@ -42,6 +72,16 @@ export default { | ||
| 42 | font-weight:800; | 72 | font-weight:800; |
| 43 | color:rgba(255,255,255,1); | 73 | color:rgba(255,255,255,1); |
| 44 | } | 74 | } |
| 75 | + .header-fullscreen{ | ||
| 76 | + width: 18px; | ||
| 77 | + height: 18px; | ||
| 78 | + line-height: 18px; | ||
| 79 | + position: absolute; | ||
| 80 | + right: 150px; | ||
| 81 | + top:30px; | ||
| 82 | + cursor:pointer; | ||
| 83 | + background: url('../assets/img/righttopbarico_Bg.png'); | ||
| 84 | + } | ||
| 45 | .time-wrap{ | 85 | .time-wrap{ |
| 46 | position: absolute; | 86 | position: absolute; |
| 47 | right: 12px; | 87 | right: 12px; |