index.vue 674 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <view>
  3. <web-view :src="url"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. var wv; //计划创建的webview
  8. export default {
  9. data() {
  10. return {
  11. url: 'https://www.tianqi.com/changchun/'
  12. }
  13. },
  14. onLoad: async function(e) {
  15. const that = this;
  16. that.$set(that, `url`, e && e.url);
  17. },
  18. onReady() {
  19. // #ifdef APP-PLUS
  20. var currentWebview = this.$scope.$getAppWebview() //获取当前页面的webview对象
  21. setTimeout(function() {
  22. wv = currentWebview.children()[0]
  23. wv.setStyle({
  24. scalable: true
  25. })
  26. }, 1000); //如果是页面初始化调用时,需要延时一下
  27. // #endif
  28. }
  29. }
  30. </script>