1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  | <template> 
 |      <view> 
 |          <button class="clear" @click="clearUrl">Clear</button> 
 |          <web-view v-if="data != ''" :src="data"></web-view> 
 |           
 |          <view style="margin-top: 100px;" v-if="data == ''"> 
 |              <input v-model="url" type="text" placeholder="输入URL"> 
 |              <button @click="setUrl">设置</button> 
 |          </view> 
 |      </view> 
 |  </template> 
 |    
 |  <script> 
 |      export default { 
 |          data() { 
 |              return { 
 |                  data: '', 
 |                  url: 'http://10.10.10.120:9090/wcs/h5/index.html' 
 |              } 
 |          }, 
 |          onShow() { 
 |              let that = this 
 |              uni.getStorage({ 
 |                  key: "data", 
 |                  success(e) { 
 |                      that.data = e.data 
 |                  } 
 |              }) 
 |              // 隐藏时间,电量,信号等 
 |          }, 
 |          methods: { 
 |              setUrl() { 
 |                  if(this.url != '') { 
 |                      uni.setStorage({ 
 |                          key: "data", 
 |                          data: this.url 
 |                      }) 
 |                      this.data = this.url; 
 |                  } 
 |              }, 
 |              clearUrl() { 
 |                  this.data = "" 
 |                  this.url = "http://10.10.10.120:9090/wcs/h5/index.html" 
 |                  uni.removeStorage({ 
 |                      key: "data" 
 |                  }) 
 |              } 
 |          } 
 |      } 
 |  </script> 
 |    
 |  <style> 
 |      .clear { 
 |          position: fixed; 
 |          top: 0; 
 |          left: 0; 
 |          z-index: 9999; 
 |          background: transparent; 
 |          border: none; 
 |      } 
 |       
 |      .clear:hover { 
 |          background: #fff; 
 |      } 
 |  </style> 
 |  
  |