洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

  1. <template>
  2. <view class="pageBg">
  3. <web-view :src="link" :webview-styles="webviewStyles" :update-title="false"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. let wv
  8. export default {
  9. data() {
  10. return {
  11. webviewStyles: {
  12. progress: {
  13. color: '#3877ff'
  14. },
  15. },
  16. link: ''
  17. }
  18. },
  19. onLoad() {
  20. this.link = this.$store.state.webViewUrl
  21. console.log('webview地址'+ this.$store.state.webViewUrl)
  22. },
  23. onReady() {
  24. let statusBar = uni.getWindowInfo().statusBarHeight
  25. // #ifdef APP-PLUS
  26. let boxHeight = 0
  27. uni.getSystemInfo({
  28. success: res => boxHeight = res.windowHeight // 屏幕可用高度
  29. })
  30. var currentWebview = this.$scope
  31. .$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
  32. setTimeout(function() {
  33. wv = currentWebview.children()[0]
  34. wv.setStyle({
  35. top: statusBar,
  36. height: boxHeight - statusBar
  37. })
  38. }, 1000); //如果是页面初始化调用时,需要延时一下
  39. // #endif
  40. }
  41. }
  42. </script>