| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <template>
- <view class="webview">
- <web-view :src="url" id="webcon" @message="handleMessage">
- </web-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- url: '',
- device_id: '',
- accessToken: ''
- }
- },
- onLoad(options) {
- this.device_id = options.device_id
- this.accessToken = options.accessToken
- this.url = "https://wx.hnyfwlw.com/wechat?device_id=" + this.device_id + "&accessToken=" + this.accessToken
- //设置 webview 界面的状态栏的 title
- uni.setNavigationBarTitle({
- title: '监控详情'
- });
- },
- methods: {
- getWebviewPage(id) {
- this.url = "/static/h5.html?device_id=" + this.device_id + "&accessToken=" + this.accessToken
- //设置 webview 界面的状态栏的 title
- uni.setNavigationBarTitle({
- title: '监控详情'
- });
- },
- handleMessage(evt) {
- console.log('接收到的消息:' + JSON.stringify(evt.detail.data));
- }
- }
- }
- </script>
- <style>
- .webview {
- width: 100vw;
- height: 100vh;
- }
- </style>
|