search
What is html5 muiJun 02, 2022 pm 02:27 PM
htmlhtml5

mui is an open source front-end UI framework based on the HTML5 specification. It takes advantage of the native capabilities of HTML5 extensions to solve the performance and cross-platform issues of common UI controls. Developers use mui to develop once and then publish it as HTML5 iOS and Android Apps can also be published to mobile browsers at the same time.

What is html5 mui

The operating environment of this tutorial: windows7 system, HTML5&&mui3.7.2 version, Dell G3 computer.

html5 MUI framework

  • A style framework matching HTML5

mui framework is a An open source front-end UI framework based on the HTML5 specification, which takes advantage of the native capabilities of HTML5 extensions to solve the performance and cross-platform issues of common UI controls.

The UI component design in MUI is based on iOS 7, supplemented by some Android-specific controls. The MUI framework effectively solves some problems of the original framework and can easily develop high-performance apps.

At the same time, mui can also automatically adapt to ordinary browsers without HTML5 environments and reduce it to ordinary web apps. This allows developers to use mui to develop once and publish it as HTML5 iOS and Android apps at the same time. to the mobile browser.

MUI’s positioning is: the UI framework for mobile apps that is closest to the native experience. It is this positioning that gives rise to several characteristics of MUI: light, small, only involving UI, only born for mobile apps, and native interface style. MUI is different from jQuery in that it does not encapsulate DOM operations and does not do anything unrelated to the UI.

mui official website:

https://dev.dcloud.net.cn/mui/

Overall layout of MUI page

Build the overall layout of the page, the top and bottom navigation bars are fixed, and the specific content is placed in

Inside the container

When browsing content, the navigation bar is fixed and only the main content changes

What is html5 mui

<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-close mui-pull-right"></a>
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="标题">标题</h1>
		</header>
		<nav class="mui-bar mui-bar-tab">
			<a class="mui-tab-item mui-active">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">What is html5 mui</span>
			</a>
		</nav>
		<div class="mui-content">
			//主体内容
		</div>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
	</body>

</html>

Built-in methods and objects

  • mui() method: equivalent to jQuery's $() method, using the css selector to obtain the HTML object and returning the mui object array
    Convert the mui object into a DOM object :
    var obj1 = mui('#title'); //miu object
    var obj2 = obj[0]; //DOM object

  • each() method : Equivalent to jQuery's each() method to perform traversal operations

  • init() method: The MUI framework concentrates many functional configurations in the mui.init() method. To use a certain For this function, you only need to complete the corresponding parameter configuration in the mui.init() method. Currently, the functions supported in the mui.init method include: Create subpages, close pages, gesture event configuration, preloading, Pull down to refresh, pull up to load, and set the system status bar background color

  • scrollTo() method: scroll the window screen to the specified position
    mui.scrollTo(ypos[,duration ][,handler])

    • ypos is an integer value, the y coordinate of the document to be displayed in the upper left corner of the window document display area.
    • duration is the rolling time period, the unit is milliseconds.
    • Handler is the callback function executed after scrolling ends.
  • mui.os object: used to determine the current running environment
    mui.os.plus: whether to run in the 5 base
    mui.os.android , mui.os.ios, mui.os.ipad, mui.os.iphone similar

    Event Management

    1. Tap event: Click to trigger

    element.addEventListener(&#39;tap&#39;,function(){
            //点击响应逻辑
     },false);

    2. Event binding: mui(selecto1).on(event,selector2,handler);

    event is a String type, which means it needs to be monitored The event name, such as "tap", handler is the callback function when the event is triggered, selector1 and selector2 are both selectors, but selector2 must be the descendant selector under the HTML element object represented by selector1

    3. Event Cancel: Cancel the bound event

    mui(selector).off()//取消selector所有事件
    mui(selector1).off(event,selector2)//取消作用于selector2的所有事件
    mui(selector1).off(event,selector2,handler)//取消作用于selector2的特定事件

    4. Event trigger: Dynamically trigger the event of a specific DOM element mui.trigger(element,event,data);

    5 , Gesture events: Introducing commonly used gesture expression methods

    ##CategoryEvent nameDescriptionTaptapClick the screen##TapLong pressLong pressLong pressSwipeSwipe##SwipeswipeupSwipe upSwipeswipedownSwipe downDragdragstartDrag startdragdragedd
    doubletap Double-click the screen
    longtap Long press the screen
    hold Hold the screen
    release Leave the screen
    swipeleft Swipe left
    swiperight Swipe right Swipe
    ## Drag
    Drag Drag
    Drag end

    窗口管理

    • HTML5+初始化: mui.plusReady(function(){ … });

    • 打开新窗口:mui.openWindow(参数配置对象);

    • 关闭窗口:MUI框架将窗口关闭功能封装在mui.back方法中,具体执行逻辑是:当前Webview为预加载页面,则hide当前Webview;否则,close当前Webview,共有三种方法实现

      • 点击class属性中包含"mui-action-back"的控件
      • 在屏幕内快速向右滑动:mui.init({swipeBack:true//启用右滑关闭功能})
      • Android自动监听back键:
    mui.init({
    	keyEventBind:{
    		backbutton:true//启用右滑关闭功能}
    		});
    • 预加载:提前创建窗口,在跳转时之间得到窗口,减少加载的过程

    mui.init({
      preloadPages:[
        {
          url:prelaod-page-url,//页面路径
          id:preload-page-id,//Webview的id
          styles:{},//窗口参数
          extras:{},//自定义扩展参数
          subpages:[{},{}]//预加载页面的子页面
        }
      ],
      preloadLimit:5//预加载窗口数量限制(一旦超出,先进先出)默认不限制
    });
    • 子页面:多个窗口合成一个,方便实现局部滚动功能

    mui.init({
        subpages:[{
          url:&#39;list.html&#39;,
          id:&#39;list.html&#39;,
          styles:{
            top:&#39;45px&#39;,//mui标题栏默认高度为45px;
            bottom:&#39;45px&#39;//默认为0px,可不定义;
          }
        }]
      });

    相关推荐:《html视频教程

    The above is the detailed content of What is html5 mui. For more information, please follow other related articles on the PHP Chinese website!

    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
    HTML超文本标记语言--超在那里?(文档分析)HTML超文本标记语言--超在那里?(文档分析)Aug 02, 2022 pm 06:04 PM

    本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

    html和css算编程语言吗html和css算编程语言吗Sep 21, 2022 pm 04:09 PM

    不算。html是一种用来告知浏览器如何组织页面的标记语言,而CSS是一种用来表现HTML或XML等文件样式的样式设计语言;html和css不具备很强的逻辑性和流程控制功能,缺乏灵活性,且html和css不能按照人类的设计对一件工作进行重复的循环,直至得到让人类满意的答案。

    web前端笔试题库之HTML篇web前端笔试题库之HTML篇Apr 21, 2022 am 11:56 AM

    总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

    HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

    HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

    总结HTML中a标签的使用方法及跳转方式总结HTML中a标签的使用方法及跳转方式Aug 05, 2022 am 09:18 AM

    本文给大家总结介绍a标签使用方法和跳转方式,希望对大家有所帮助!

    html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

    html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

    html中document是什么html中document是什么Jun 17, 2022 pm 04:18 PM

    在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

    html5支持boolean值属性吗html5支持boolean值属性吗Apr 22, 2022 pm 04:56 PM

    html5支持boolean值属性;boolean值属性指是属性值为true或者false的属性,如input元素中的disabled属性,不使用该属性表示值为flase,不禁用元素,使用该属性可以不设置属性值表示值为true,禁用元素。

    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

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    Repo: How To Revive Teammates
    1 months agoBy尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    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),

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools