uni-app 项目如何通过webview获得加载网页的html源代

index.vue 下创建webview窗口并加载网页方法如下
相关API Reference https://www.html5plus.org/doc/zh_cn/webview.html

                this.url = 'http://www.baidu.com';
                let styles = {
                        top: '0px',
                        width: '100%',    
                        zindex:0,
                        position: 'static',
                        titleNView: {
                            "autoBackButton": true,
                            "backgroundColor": '#202028',
                            "titleColor": '#ffffff',
                             
                        } ,
                        "hardwareAccelerated" : true, //开启硬件加速
                        "allowsInlineMediaPlayback": true,//ios关闭原生控件    
                                  
                };
                
                this.webview = plus.webview.create('','webview', styles, {}); 
                this.webview.loadURL(this.url)     
                this.webview.show(); 

我想获取这个 url 页面的html源码字符串数据,如何实现??

阅读 4.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题