How to load external web pages or server data using the MUI framework

亚连
Release: 2018-06-08 16:50:54
Original
3056 people have browsed it

Below I will share with you a brief discussion on the method of loading external web pages or server data in the MUI framework. It has a good reference value and I hope it will be helpful to everyone.

When many of our students implement the MUI framework, they often use the mui.openwindow method when opening a new page. However, when encountering a web page, it needs to be downloaded from the server or nested externally. When loading a web page, due to network speed issues, a white screen may appear during loading and the waiting time may be too long, resulting in a poor user experience.

Use plus.webview when loading the page. The create method solves this problem very well.

Without further ado, just paste the code

First we need to create a parent page ,The following is the JS of the parent page

// H5 plus事件处理 function plusReady(){ var nwaiting = plus.nativeUI.showWaiting();//打开原生加载等待框 ws=plus.webview.currentWebview();//创建一个新的页面 embed=plus.webview.create(“createShow.html”,”“,{bottom:”0px”});//新的页面地址 embed.onclose=embedClose; ws.append(embed); } if(window.plus){ plusReady(); }else{ document.addEventListener(“plusready”,plusReady,false); } // 页面关闭事件回调函数 function embedClose(e){ alert( “Closed!” ); }
Copy after login

Create a createShow.html sub-page, this is the name I gave myself,

mui.init({ //示例打开百度,进行加载 subpages:[{ url:"https://www.baidu.com", id:"https://www.baidu.com", styles:{ } }] })
Copy after login
mui.plusReady(function(){ var ws = plus.webview.currentWebview();//加载进外部网页,加载完成关闭等待框 ws.show('slide-in-right', 50); plus.nativeUI.closeWaiting(); } )
Copy after login

The above is what I compiled for everyone, I hope it will be useful to everyone in the future helpful.

Related articles:

Using the image lazy loading plug-in in vue-lazyload

How to use highCharts to draw a 3d pie chart in Vue

How to use ueditor in vue

The above is the detailed content of How to load external web pages or server data using the MUI framework. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!