search
HomeWeb Front-endHTML TutorialHTML5 mobile app development tutorial 4-Differences between several open pages in mui_html/css_WEB-ITnose

[Foreword]

I used hbuilder mui to make an app for a while, and encountered a lot of problems during the period.

I explored it myself and made an app. For details, see: http:/ /uikoo9.com/dishi/download

If your level is higher than this, don’t read it and just skip it.




【Level】

Due to using hbuilder mui I didn't look at the source code out of interest.

It stayed at the usage summary level, so please forgive me for any mistakes.




【Several ways to open the page】

1. Initialization Create a subpage when

2. Open a new page directly

3. Preload page




[Example]

1. Create a subpage during initialization

mui.init({    subpages: [{        url: your - subpage - url, //子页面HTML地址,支持本地地址和网络地址        id: your - subpage - id, //子页面标志        styles: {            top: subpage - top - position, //子页面顶部位置            bottom: subpage - bottom - position, //子页面底部位置            width: subpage - width, //子页面宽度,默认为100%            height: subpage - height, //子页面高度,默认为100%            ......        },        extras: {} //额外扩展参数    }]});

2. Open a new page directly

mui.openWindow({    url: new - page - url,    id: new - page - id,    styles: {        top: newpage - top - position, //新页面顶部位置        bottom: newage - bottom - position, //新页面底部位置        width: newpage - width, //新页面宽度,默认为100%        height: newpage - height, //新页面高度,默认为100%        ......    },    extras: {        ..... //自定义扩展参数,可以用来处理页面间传值    }    show: {        autoShow: true, //页面loaded事件发生后自动显示,默认为true        aniShow: animationType, //页面显示动画,默认为”slide-in-right“;        duration: animationTime //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;    },    waiting: {        autoShow: true, //自动显示等待框,默认为true        title: '正在加载...', //等待对话框上显示的提示内容        options: {            width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度            height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度            ......        }    }})

3. Preload page

// 方式1mui.init({    preloadPages: [{        url: prelaod - page - url,        id: preload - page - id,        styles: {}, //窗口参数        extras: {}, //自定义扩展参数        subpages: [{}, {}] //预加载页面的子页面    }]});// 方式2var page = mui.preload({    url: new - page - url,    id: new - page - id, //默认使用当前页面的url作为id    styles: {}, //窗口参数    extras: {} //自定义扩展参数});




[Some differences]

1. Subpages and non-subpages

Among the above three methods, the pages opened in 2 and 3 are not subpages.

The difference is that the subpage is equivalent to an iframe in html, not an iframe in html. A subpage is equivalent to opening a new browser window and loading an html


2. Subpages are suitable for side-sliding menus

Subpages have their own advantages , especially suitable for the situation of index.html list.html,

If it is implemented with index.html (main page) list.html (sub-page), when the main page slides right, the sub-page will automatically follow.

If it is implemented using index.html (main page) list.html (new page), the main page will slide right, but the new page will not slide right, and the new page must be processed separately.


3. Frequent switching of sub-pages

If you frequently swipe left and right, list.html will appear blocked on mobile phones with lower configurations. In the case of index.html,

will not work if you use sub-page mode, and the probability of using new page mode is very high.


4. Subpages are suitable for pull-down refresh and pull-up loading

When doing large pull-down refresh before, the form of a new page was used,

Following the official website tutorial, no matter how you try it, it doesn’t work.

Later I looked at the source code and found that the drop-down refresh must be in the form of a subpage.

is your list.html It must be a subpage of index.html before it can be refreshed by pulling down.


5. New page is suitable for new page

open a new page, suitable for viewing details and the like, when you need to open a new page.

And mui encapsulates the back method of the new page itself, so you don’t need to worry about it.


6. Two ways to preload the page

The first is to preload during initialization,

In this case Suitable for you to use this page after a long time.

If you want to go to the page immediately and use it, then you will get null.

The second method is similar to open,

Personally, there is not much difference,

The only difference is that open opens it directly,

Preload is just loading, you can choose when to open it later.


7. Summary

If you need to pull down to refresh and pull up to load, please use a subpage,

If you need to open a new page, please use a new page Method,

needs to load a page but will not use it temporarily, please use the preloading method.

Statement
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
The Future of HTML: Evolution and TrendsThe Future of HTML: Evolution and TrendsMay 13, 2025 am 12:01 AM

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

Why are HTML attributes important for web development?Why are HTML attributes important for web development?May 12, 2025 am 12:01 AM

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

What is the purpose of the alt attribute? Why is it important?What is the purpose of the alt attribute? Why is it important?May 11, 2025 am 12:01 AM

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),