Problems encountered in the framework mui

NO.1 data transfer between the pages of

1, by extras way

First, the parent page by mui.openWindow following extras value passed to the sub-page, the sub-page bymui.plusReady

var self = plus.webview.currentWebview();  
bandID = self.id

This way passed by value, only the first loads of time to get to, if time frequently accepted parameters, monitoring can not change the data.

2, by way of custom

In the first sub-page parent page preloading needed, for example:

mui.init ({ 
	swipeBack: to true, // enable right slide off function 
	preloadPages: [{ 
				ID: 'children.html', 
				URL: 'children.html' // path subpages 
			}] 
	});

  

Then the parent page by following this way:

// define an outermost layer detailpage, first determines whether the page has been opened each 
IF (detailPage!) { 
	DetailPage = plus.webview.getWebviewById ( 'dbcklist_detail.html'); 
} 
// then be mui.fire pass the required value, the value of an object to me 
// trigger event details page cgdd_goodsid 
mui.fire (detailPage, 'cgdd_goodsid', { 
	cgdd_goodsid: goodsid, 
}); 
// finally to open sub-pages   
mui.openWindow ({ 
	ID: 'dbcklist_detail.html' 
});		    

 Then by monitoring the sub-page, the acquired data transmission over the parent page, as follows:

// parent page mui.fire monitor data transmission over cgdd_goodsid 
window.addEventListener ( 'cgdd_goodsid', function (E) { 
	var goodsid = e.detail.cgdd_goodsid; // This data is passed from parent page over 

})

 This data transfer mode, can be monitored, even if the page jump frequently, you can.

Of course, if there is a more appropriate way, we can discuss together yo ,,,,,,

NO.2 sub-pages are references to the parent page, and is referenced parent parent page , data acceptance problems

My personal page at the same time by preloadPages father and son shared a reference page when first open the parent page, open public pages from the parent page, the data transfer from the parent page can get to the normal operation (this path is not a problem)

Then Then, the jump to the parent element subpage, subpage also open public pages, this time, does not detect any data transfer over the sub-pages, two pages by value exactly, but open on the monitoring of the page less than data, do not know what the situation, solving ,,,,,,

Guess you like

Origin www.cnblogs.com/cmlblogcp/p/12023892.html