This time I will bring you the mui page jump method. What are the precautions when using the mui page jump method. The following is a practical case, let’s take a look.
[Several ways to open a page]
1. Create a subpage during initialization
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 the page
// 方式1 mui.init({ preloadPages: [{ url: prelaod - page - url, id: preload - page - id, styles: {}, //窗口参数 extras: {}, //自定义扩展参数 subpages: [{}, {}] //预加载页面的子页面 }] }); // 方式2 var 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 subpages are equivalent to those in html The iframe instead of the subpage is equivalent to opening a new browser window and loading an html
2. The subpage is suitable for the side sliding menu
The subpage has It has some 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 It will follow automatically.
If implemented with 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 covering the index on mobile phones with lower configurations. In the case of html,
it won’t happen if you use sub-page mode, and the probability of using new page mode is very high.
4. Sub-pages 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,
According to the official website tutorial, no matter how I try it, it fails.
Later I looked at the source code and found that the pull-down refresh must be in the form of a sub-page.
That is, your list.html must be index .html subpages can be pulled down to refresh.
5. New page is suitable for new pages
Open a new page, suitable for viewing details and the like, when you need to open a new page,
And mui itself encapsulates the back method of the new page, so you don't need to worry about it.
6. Two ways to preload the page
The first is to preload during initialization,
This situation is suitable for you This page will not be used until a long time later.
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 the new page method.
If you need to load a page but will not use it temporarily, please use the preloading method.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
##H5How to make fragmented picture switching
The above is the detailed content of Mui page jump method. For more information, please follow other related articles on the PHP Chinese website!

Best practices for H5 code include: 1. Use correct DOCTYPE declarations and character encoding; 2. Use semantic tags; 3. Reduce HTTP requests; 4. Use asynchronous loading; 5. Optimize images. These practices can improve the efficiency, maintainability and user experience of web pages.

Web standards and technologies have evolved from HTML4, CSS2 and simple JavaScript to date and have undergone significant developments. 1) HTML5 introduces APIs such as Canvas and WebStorage, which enhances the complexity and interactivity of web applications. 2) CSS3 adds animation and transition functions to make the page more effective. 3) JavaScript improves development efficiency and code readability through modern syntax of Node.js and ES6, such as arrow functions and classes. These changes have promoted the development of performance optimization and best practices of web applications.

H5 is not just the abbreviation of HTML5, it represents a wider modern web development technology ecosystem: 1. H5 includes HTML5, CSS3, JavaScript and related APIs and technologies; 2. It provides a richer, interactive and smooth user experience, and can run seamlessly on multiple devices; 3. Using the H5 technology stack, you can create responsive web pages and complex interactive functions.

H5 and HTML5 refer to the same thing, namely HTML5. HTML5 is the fifth version of HTML, bringing new features such as semantic tags, multimedia support, canvas and graphics, offline storage and local storage, improving the expressiveness and interactivity of web pages.

H5referstoHTML5,apivotaltechnologyinwebdevelopment.1)HTML5introducesnewelementsandAPIsforrich,dynamicwebapplications.2)Itsupportsmultimediawithoutplugins,enhancinguserexperienceacrossdevices.3)SemanticelementsimprovecontentstructureandSEO.4)H5'srespo

The tools and frameworks that need to be mastered in H5 development include Vue.js, React and Webpack. 1.Vue.js is suitable for building user interfaces and supports component development. 2.React optimizes page rendering through virtual DOM, suitable for complex applications. 3.Webpack is used for module packaging and optimize resource loading.

HTML5hassignificantlytransformedwebdevelopmentbyintroducingsemanticelements,enhancingmultimediasupport,andimprovingperformance.1)ItmadewebsitesmoreaccessibleandSEO-friendlywithsemanticelementslike,,and.2)HTML5introducednativeandtags,eliminatingthenee

H5 improves web page accessibility and SEO effects through semantic elements and ARIA attributes. 1. Use, etc. to organize the content structure and improve SEO. 2. ARIA attributes such as aria-label enhance accessibility, and assistive technology users can use web pages smoothly.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.