index.vue 623 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <web-view
  3. class="web-view"
  4. :webview-styles="webviewStyles"
  5. :src="url"
  6. :style="{ width: windowW + 'px', height: windowH + 'px' }"
  7. ></web-view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. windowH: 0,
  14. windowW: 0,
  15. webviewStyles: {
  16. progress: {
  17. color: "transparent",
  18. },
  19. },
  20. url: "",
  21. };
  22. },
  23. onLoad(option) {
  24. this.url = option.url;
  25. try {
  26. const res = uni.getWindowInfo();
  27. this.windowW = res.windowWidth;
  28. this.windowH = res.windowHeight;
  29. } catch (e) {
  30. // error
  31. }
  32. },
  33. };
  34. </script>