| | |
| | | <template> |
| | | <view>1231</view> |
| | | <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() { |
| | | var i; |
| | | setInterval(()=>{ |
| | | console.log(i++); |
| | | },1000) |
| | | 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> |