index.vue 587 B

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