Knowledge points in this section
- Four prompt boxes of MUI
(1) Warning box
- There are three parameters in total. The first is the content, the second is the prompt, and the third is the callback function
mui.alert("Welcome to use MUI Warning box","Mui Tips",function(){ alert("You just closed the warning box"); })
(2) Message confirmation box
- There are four parameters. The first is the content, the second is the title of the prompt, the third is the text on the button, and the fourth is the callback function
The actual situation is on the right, because let the user click
/*Confirmation box component*/ button2.addEventListener("tap",function(){ var arr = ["yes","no"]; mui.confirm("You like it MUI Frame??","Prompt box title",arr,function(e){ if(e.index==0) { alert("You clicked"); }else { alert("Did you click Yes No"); } }) }) /*Confirmation box component*/
(3) Input box components
There are 5 parameters in total: the first content, the second input box content, the third title, the text above the fourth button, and the fifth callback function. In the callback function, e.index and e.value are used to judge the text clicked and entered
button3.addEventListener("tap",function(){ var arr = ["Thank you.","Please comment"]; mui.prompt("Please enter this evaluation","Good content","Evaluation headline",arr,function(e){ if(e.index==0) { alert("You click Yes and type yes"+e.value); }else { alert("Did you click Yes No"); } }) })
(4) Automatic message prompt box is used most
So he'll hide it after loading
button4.addEventListener("tap",function(){ mui.toast("Loading"); })
(5) Date box plus.nativeUI.pickDate
/*Date selection box start*/ button5.addEventListener("tap",function(){ //The month in js starts from 0, that is to say, 0 in js is January var dDate=new Date(); //Time displayed by default dDate.setFullYear(2018,1,28); var minDate=new Date(); //Optional minimum time minDate.setFullYear(2010,0,1); var maxDate=new Date(); //Maximum time for class selection maxDate.setFullYear(2020,12,31); plus.nativeUI.pickDate( function(e) { var d=e.date; alert('The date you selected is:'+d.getFullYear()+"-"+(d.getMonth()+1)+"-"+ d.getDate()); },function(e){ alert('You have not selected a date'); },{title:"Please select a date",date:dDate,minDate:minDate,maxDate:maxDate}); })
(6) Time frame pickTime
var dTime=new Date(); dTime.setHours(20,0); //Set default time plus.nativeUI.pickTime(function(e){ var d=e.date; alert("The time you choose is:"+d.getHours()+":"+d.getMinutes()); },function (e){ alert('You didn't choose a time'); },{title:"Please select a time",is24Hour:true,time:dTime});
Author: I embrace my future
Link: https://www.jianshu.com/p/0b9b5e06ba48
Source: Jianshu