Commit 366628346420d7488b180a8904d4fcdd3b2f5aa5

Authored by Andy
1 parent 3bafd7ad

add 全屏功能

src/components/appHeader/index.vue
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 <div class="app-headBox"> 2 <div class="app-headBox">
3 <span class="head-inner"> 3 <span class="head-inner">
4 <div class="head-name"> <span>{{headTitle}}</span><div class="head-name-bg"></div></div> 4 <div class="head-name"> <span>{{headTitle}}</span><div class="head-name-bg"></div></div>
  5 + <div class="header-fullscreen" @click="handleFullScreen"></div>
5 <div class="head-time">{{ headTime }}</div> 6 <div class="head-time">{{ headTime }}</div>
6 </span> 7 </span>
7 </div> 8 </div>
@@ -14,7 +15,8 @@ @@ -14,7 +15,8 @@
14 data() { 15 data() {
15 return { 16 return {
16 headTitle:"",//城市智慧停车大数据中心 17 headTitle:"",//城市智慧停车大数据中心
17 - headTime:''//当前时间 18 + headTime:'',//当前时间
  19 + fullscreen: false
18 } 20 }
19 }, 21 },
20 mounted() { 22 mounted() {
@@ -30,6 +32,32 @@ @@ -30,6 +32,32 @@
30 _self.headTime=common.getNowFormatDate(); 32 _self.headTime=common.getNowFormatDate();
31 },1000);//1分钟更新一次 33 },1000);//1分钟更新一次
32 }, 34 },
  35 + handleFullScreen(){
  36 + let element = document.documentElement;
  37 + if (this.fullscreen) {
  38 + if (document.exitFullscreen) {
  39 + document.exitFullscreen();
  40 + } else if (document.webkitCancelFullScreen) {
  41 + document.webkitCancelFullScreen();
  42 + } else if (document.mozCancelFullScreen) {
  43 + document.mozCancelFullScreen();
  44 + } else if (document.msExitFullscreen) {
  45 + document.msExitFullscreen();
  46 + }
  47 + } else {
  48 + if (element.requestFullscreen) {
  49 + element.requestFullscreen();
  50 + } else if (element.webkitRequestFullScreen) {
  51 + element.webkitRequestFullScreen();
  52 + } else if (element.mozRequestFullScreen) {
  53 + element.mozRequestFullScreen();
  54 + } else if (element.msRequestFullscreen) {
  55 + // IE11
  56 + element.msRequestFullscreen();
  57 + }
  58 + }
  59 + this.fullscreen = !this.fullscreen;
  60 + },
33 61
34 } 62 }
35 } 63 }
@@ -77,6 +105,16 @@ @@ -77,6 +105,16 @@
77 left:280px; 105 left:280px;
78 z-index: 10; 106 z-index: 10;
79 } 107 }
  108 + .header-fullscreen{
  109 + width: 18px;
  110 + height: 18px;
  111 + line-height: 18px;
  112 + position: absolute;
  113 + right: 158px;
  114 + top:25px;
  115 + cursor:pointer;
  116 + background: url('../../images/head/righttopbarico_Bg.png');
  117 + }
80 .head-time{ 118 .head-time{
81 font-size:14px; 119 font-size:14px;
82 color:#b2c2cf; 120 color:#b2c2cf;
src/images/head/righttopbarico_Bg.png 0 → 100644

945 Bytes