mui frame each page load operation

In recent optimize their use mui developed app, mainly for interactive piece children, simply here to tell you that the scene about the problems that I was creating a base operating area can be switched by means of the bottom of the tabBar added dynamically, as follows :

mui.init ();
var defaultPage = "Tab-Webview-subpage-product.html"; // default options defined clip page
var newPage = '';
// define all subpages
var subpages = [ 'tab-webview -subpage -product.html ',' Tab-Webview-subpage-shopping.html ',
' Tab-Webview-subpage-Me.html '
];
// page load subpage after loading
mui.plusReady (function () {
var Current = plus.webview.currentWebview (); // Get current page window object
// loads all sub-pages
for (the let I = 0; I <. 3; I ++) {
var sub = plus.webview.create (subpages [I] , subpages [I], {
Top: '0px',
bottom: '50px'
}
);
// default page addition, the other sub-pages hidden
! IF (subpages [I] = defaultPage) {
sub.hide ();
}
current.append (sub);// adding subpages window object
}
});
// Create a click event
MUI {( "NAV-TabBar #") ON ( "TAP", "A", function (E.)
NewPage = this.id + ".html";
IF (== defaultPage newPage) {
return;
};
plus.webview.hide (defaultPage); // hides on a sub-page
plus.webview.show (this.id + ".html") // display the current page, click
newPage = defaultpage = this. id + ".html"; // record the current page, click
});

Multiple html pages generated by this method have a problem that can not be used mui.ready or mui, plusReady to monitor the page is loaded, so do not refresh the page content or operation of some data, then think of the definition of self event mui, fire method, but also proven unworkable, where the only solution is to have the page refresh required to write the following code

mui.plusReady (function () {
// each entry to trigger the following functions on this page

plus.webview.currentWebview().addEventListener("show",function(){

// define your approach here

},false);

})

Guess you like

Origin www.cnblogs.com/shenwh/p/11240001.html