search
HomeWeb Front-endJS TutorialSimple experience of mobile development with mui framework

Simple experience of mobile development with mui framework

Jan 25, 2018 am 10:25 AM
experiencedevelopSimple

Have you ever used mui to develop? This article mainly introduces the detailed explanation of the first experience of mobile development with the mui framework. The editor thinks it is quite good. I will share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.

1. Status bar settings

Now when most apps are opened, the status bar is integrated with the APP, which is not only beautiful, but also coordinated with the whole.

The blogger is a moderate obsessive-compulsive disorder patient, and the little black bar at the top really makes me uncomfortable.

First, we create a new mobile APP project on HBuilder

1.1 Immersive status bar (transparent status bar)

Generally, when the entire page is a picture, the status bar will be transparent.

First, detect whether the current environment supports the immersive status bar. Detection statement:

<script>
  document.addEventListener(&#39;plusready&#39;, function(){
    //是否支持沉浸式状态栏
    alert(plus.navigator.isImmersedStatusbar());
    
  });
</script>

is not supported by default and false will pop up. If you want the environment to support it, you need to modify the configuration file manifest.json under the project

There is a manifest.json file under the project. After opening it, open the code view:

Add

    "statusbar": {
      "immersed": true
    },

under the code view "plus" as shown in the picture:

##After the modification is completed, true will pop up, the effect is as follows:

Terminal support:

  • Android4.4 and above system support;

  • iOS7 .0 and above systems support


1.2 Full screen status bar

Full screen status bar means there is no status bar, and the battery and signal are not displayed.

This effect is to add the statement in the JS file:

<script>
  document.addEventListener(&#39;plusready&#39;, function(){
    //参数:true - 全屏;false - 不全屏
    plus.navigator.setFullscreen(true);
    
  });
</script>
The effect is as follows:

##1.3 Status bar background color

Modifying the background color is generally used in scenarios where the background color at the top of the page is a solid color. Modify it to the same background color as the page to make the page more harmonious.

//设置系统状态栏背景色
plus.navigator.setStatusBarBackground('#6495ED');

The Android platform does not support this function. If there is an expert, please give me some advice.

2. Frosted glass effect

Blurring pictures can give people a hazy and beautiful effect. Click on the image blur effect not mentioned before:

css attribute filter:

filter: blur(16px);

The pixels in blur() are the degree of blur.

3. Simply use mui to quickly build a page

The status bar problem that bothered me most has been solved, and the page layout is easier to handle. It can be built quickly using mui templates.

Take XX Music as an example:

2.1 Import file

  <script></script>
  <link>
  <link>

2.2HTML code

The following HTML code is the mui framework part used and the above status bar The relevant part, this mui is about the regional carousel part

The top img is the background image, the p wrapped in the outer layer is very necessary, and the overflow attribute must be used flexibly to achieve perfect effects.

Because the header part of the APP uses positioning, the main part of the page needs to add a padding-top with a height of about 74px

  <p>
       </p><p>
         </p><p>
          第一个轮播区域
         </p>
         <p>
          </p><p>
            <span></span>
            <span>G-DRAGON</span>
            <span></span>
          </p>
          <p>
            <img  src="/static/imghwm/default1.png" data-src="img/player_btn_sq_hlight.png" class="lazy" alt="Simple experience of mobile development with mui framework" >
            <img  src="/static/imghwm/default1.png" data-src="img/player_btn_mv_normal.png" class="lazy" alt="Simple experience of mobile development with mui framework" >
            <img  src="/static/imghwm/default1.png" data-src="img/player_btn_dts_on.png" class="lazy" alt="Simple experience of mobile development with mui framework" >
          </p>
          
          <p>
            <img  src="/static/imghwm/default1.png" data-src="img/GD.jpg" class="lazy" alt="Simple experience of mobile development with mui framework" >
          </p>
          
          <p>A Boy - G-DRAGON</p>
          
          
         
         <p>
          第二个轮播区域
         </p>
       
       <p>
        </p><p></p>
        <p></p>
        <p></p>
       
    

Main css code:

*{
  padding: 0px;
  margin: 0px;
}
body{
  overflow: hidden;
  height: 100vh;
}
#background{
  overflow: hidden;
  text-align: right;
}
#background #backImg{
  margin-left: -120px;
  height: 99vh;
  filter: blur(16px);
}
.mui-bar-nav{
  top: 30px;
  background-color: rgba(0,0,0,0);
  box-shadow: 0 0px 0px #ccc;
}
.mui-bar-nav .mui-title{
  color: white;
  font-size: 20px;
  font-weight: normal;
  line-height: 50px;
}
#continer{
  width: 100%;
  height: 100vh;
  position: relative;
  top: -100vh;
  z-index: 5;
  padding-top: 80px;
  background-color: rgba(0,0,0,0.7);
  text-align: center;
  color: white;
}

The latter is different I didn’t think of center-aligning the large and small pictures for a moment. Here we need to use the cross-axis alignment of flexible layout:

#continer .footer1{
  margin-bottom: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
}

Show the effect below:

小q It is said that

bloggers also want to improve themselves when writing blogs, and they also ask for advice from experts.

In addition, the framework is indeed easy to use, but the blogger feels that you still have to master the native code first.

Related recommendations:

How to use the MUI framework in mobile HTML5

Mui uses jquery and uses click to jump to a new window example sharing

Example details the encapsulation process of mui pull-up to load more pull-down refresh data

The above is the detailed content of Simple experience of mobile development with mui framework. 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
The Evolution of JavaScript: Current Trends and Future ProspectsThe Evolution of JavaScript: Current Trends and Future ProspectsApr 10, 2025 am 09:33 AM

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

Demystifying JavaScript: What It Does and Why It MattersDemystifying JavaScript: What It Does and Why It MattersApr 09, 2025 am 12:07 AM

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

Is Python or JavaScript better?Is Python or JavaScript better?Apr 06, 2025 am 12:14 AM

Python is more suitable for data science and machine learning, while JavaScript is more suitable for front-end and full-stack development. 1. Python is known for its concise syntax and rich library ecosystem, and is suitable for data analysis and web development. 2. JavaScript is the core of front-end development. Node.js supports server-side programming and is suitable for full-stack development.

How do I install JavaScript?How do I install JavaScript?Apr 05, 2025 am 12:16 AM

JavaScript does not require installation because it is already built into modern browsers. You just need a text editor and a browser to get started. 1) In the browser environment, run it by embedding the HTML file through tags. 2) In the Node.js environment, after downloading and installing Node.js, run the JavaScript file through the command line.

How to send notifications before a task starts in Quartz?How to send notifications before a task starts in Quartz?Apr 04, 2025 pm 09:24 PM

How to send task notifications in Quartz In advance When using the Quartz timer to schedule a task, the execution time of the task is set by the cron expression. Now...

In JavaScript, how to get parameters of a function on a prototype chain in a constructor?In JavaScript, how to get parameters of a function on a prototype chain in a constructor?Apr 04, 2025 pm 09:21 PM

How to obtain the parameters of functions on prototype chains in JavaScript In JavaScript programming, understanding and manipulating function parameters on prototype chains is a common and important task...

What is the reason for the failure of Vue.js dynamic style displacement in the WeChat mini program webview?What is the reason for the failure of Vue.js dynamic style displacement in the WeChat mini program webview?Apr 04, 2025 pm 09:18 PM

Analysis of the reason why the dynamic style displacement failure of using Vue.js in the WeChat applet web-view is using Vue.js...

How to implement concurrent GET requests for multiple links in Tampermonkey and determine the return results in sequence?How to implement concurrent GET requests for multiple links in Tampermonkey and determine the return results in sequence?Apr 04, 2025 pm 09:15 PM

How to make concurrent GET requests for multiple links and judge in sequence to return results? In Tampermonkey scripts, we often need to use multiple chains...

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)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use