HTML5 + and MUI page actions

Recent always encounter some operations for a page, following are some easy ways to webview and personal understanding.
For more detailed information, please refer to the standard documentation: HTTP: //www.html5plus.org/doc/zh_cn/webview.html#plus.webview.getLaunchWebview
Webview application window management module interface, logic control multi-window management operations. You can obtain the application interface management objects through plus.webview.
The method of
all: Get all webview page
close: Close Webview window
creat: Create a new Webview window
currentWebview: get the current window WebviewObject objects
getWebviewById: Find WebviewObject window specify the identity of
getLaunchWebview: Home WebviewObject obtain application window object
getTopWebview: obtaining application stack display the WebviewObject window object
hide: hide Webview window
open: create and open a window Webview
show: window displays Webview
defaultHardwareAccelerated: get hardware acceleration is turned on by default Webview
usage
plus.webview.all ()
Gets all webview page and placed inside an array, and the first element of the array is the entry page to load applications.
plus.webview.close (id_wvobj, aniClose, DURATION, Extras)
plus.webview.hide (id_wvobj, aniHide, DURATION, Extras)

    id_wvobj: (String | WebviewObject) Required To close Webview id window or window object

if the object has been operating window closed, there was no any effect. When using the window id, the id of the corresponding lookup window, if a plurality of identical first window id open windows the operation, if not find the object corresponding to the id WebviewObject, no no effect.

    aniClose / aniHide: (AnimationTypeClose) optionally Close / hide the window animation Webview

If no close / hide the window animation, the default value of "auto", i.e. set window animation displayed using the corresponding closing / Hide animation.

    duration: (Number) Optional off duration Webview window animation

unit is ms, if not set the time using the display window animations.

    extras: (WebviewExtraOptions) Optional Close window Webview Webview expansion parameter allows you to specify whether to use the picture window animation accelerated.

plus.webview.create (url, the above mentioned id, Styles, Extras)

    url: (String) Optional new window loaded HTML page address, can support a local address and network address.
    id: (String) Optional identify a new window

Window can be used to identify other pages to find the window specified by getWebviewById, in order to maintain the uniqueness of the window identified, you should avoid using the same identity to create multiple Webview window. If the incoming string is invalid url parameter id values as WebviewObject window.

    styles: (WebviewStyles) optionally created styles Webview window (e.g., window width, height, location and other information)
    Extras: (JSON) optional additional parameters created Webview extended window

is JSON type, the parameters can be set directly by the extended Webview dot ( ".") operator to get extended attribute parameter values, such as:
var plus.webview.create W = ( 'url.html', 'ID', {}, {PRELOAD: "PRELOAD Webview"});
/ / may be obtained directly by a process preload value
console.log (w.preload); // output value is "preload Webview"
plus.webview.currentWebview (); - often used, is very important! ! !
plus.webview.getWebviewById (string); - often used, it is very important! ! !
If the id is empty, return null value
plus.webview.getLaunchWebview ();
application window object Home WebviewObject
plus.webview.getTopWebview ();
Get the application display window object WebviewObject top of the stack
plus.webview.open (url, the above mentioned id, Styles, aniShow, DURATION, showedCB)

    url: (String) Optional HTML page address to open the window to load, can support local address and network address.
    id: (String) optional open identifies the window of

a window can be used to identify other pages to find the window specified by getWebviewById, in order to maintain the uniqueness of the window identified, you should avoid using the same identity to create multiple Webview window. If the incoming string is invalid url parameter id values as WebviewObject window.

    styles: (WebviewStyles) Optional created Webview window styles (such as window width, height, location and other information)
    aniShow: (AnimationTypeShow) optional display Webview window animation

if the animation does not specify a window, the default no animation "none . "

    duration: (Number) optional display duration Webview window animation

unit is ms, if not set the default window animation time 600ms.

    showedCB: (SuccessCallback) Optional Webview window displays the completion callback function

when designated Webview window display animation trigger callback function is finished, this will trigger a callback when no window animation effects (such as "none" animation).

plus.webview.show (id_wvobj, aniShow, duration, showedCB, extras);

    id_wvobj: (String | WebviewObject) Required to be displayed Webview id window or window object

if the operation Webview window object display, no any effect. When using the window id, the id of the corresponding lookup window, if a plurality of identical id Windows operation is first created, if not find the object corresponding to the id WebviewObject, no no effect.

    aniShow: (AnimationTypeShow) optional display animation Webview window

if no window animation type, the default value of "auto", i.e., a display window on the animation automatically selecting, if not been seen before, use the "none" animation.

    duration: (Number) optional display duration Webview window animation

unit is ms, if not set the default window animation time 600ms.

    showedCB: (SuccessCallback) Optional Webview window displays the completion callback function

when designated Webview window display animation trigger callback function is finished, this will trigger a callback when no window animation effects (such as "none" animation).

    extras: (WebviewExtraOptions) optional display window Webview expansion parameter

can be used to specify whether the picture window animation Webview accelerated.
Plus.webview.defaultHardwareAccelerated boolean ();
Webview window hardware acceleration enabled by default returns true, otherwise returns false.

1. Using create () method creates a need to use show () method is displayed.
2.open () method is similar to simultaneous execution create () and show ().
3.close, hide, open, show
every time I use these types of methods
to get the page: var detailPage = plus.webview.getWebviewById ( 'main ');
then the page is operating: detailPage.close ();
if it is Hide the current page directly plus.webview.currentWebview () hide ();.
4. because the use of mui, mui page so the combination of the operations described at
mui in part related to the webview, but for common operations done some plus.webview package, call to make common operations easier. More comprehensive api, in plus.webview years.
Operation mui detail page reference: HTTP: //dev.dcloud.net.cn/mui/window/#pageinit
mui.init (); // initialize the page
mui.init ({
preloadPages: [// initialization page preloading {url: prelaod-page-url , id: preload-page-id, styles: {}, // window parameters extras: {}, // custom extensions parameter subpages: [{}, {} ] // preloaded subpages pages}],
})
mui.preload (); // page preloading
mui.init ({subpages: [{// create subpages url: 'list.html', id: 'list.html', styles: {top: '45px', // mui title bar default height is 45px; bottom : '0px' // default 0px, not defined;}}]});
mui.openWindow (); // open a new page
each time with mui.openWindow not close the page will cause excessive memory consumption. This is because mui.openWindow jump page will be used plus.webview.show method, if you do not close the new page will open a lot of repetitive webview, thus causing multiple pages at the same time consume memory.
Also do not close all unused webview, webview will close after being exposed to other not close the webview.
Close package to mui.back () method, you can reference if you need to close the close method
---------------------
Author: Yu Qin
Source: CSDN
Original: https : //blog.csdn.net/xuepan1994/article/details/51891923
Disclaimer: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/xiaoshen666/p/11245841.html