webview.vue 799 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="webview">
  3. <web-view :src="url" id="webcon">
  4. </web-view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. url: '',
  12. device_id: '',
  13. accessToken: ''
  14. }
  15. },
  16. onLoad(options) {
  17. this.device_id = options.device_id
  18. this.accessToken = options.accessToken
  19. console.log(options)
  20. this.getWebviewPage()
  21. },
  22. methods: {
  23. getWebviewPage(id) {
  24. this.url = "/static/h5.html"
  25. uni.setStorage({
  26. key: 'obj',
  27. data: JSON.stringify({
  28. device_id: this.device_id,
  29. accessToken: this.accessToken
  30. })
  31. })
  32. //设置 webview 界面的状态栏的 title
  33. uni.setNavigationBarTitle({
  34. title: '监控详情'
  35. });
  36. }
  37. }
  38. }
  39. </script>
  40. <style>
  41. .webview {
  42. width: 100vw;
  43. height: 100vh;
  44. }
  45. </style>