MUI is a H5 cross-platform development framework, starting with learning to browse the website first
Official website: http://dcloud.io/
Recommend an article for beginners: https://segmentfault.com/a/1190000005173713?_ea=841544
No mind to read the document, you can watch some video tutorials
problem One: Ajax requests no data (real-machine debugging)
Enter the request URL in the browse to get the data, but the real Machine debug Console.log (type); print as Abort
Error:function (XHR, type, Errorthrown) {
//exception handling;
Console.log (type);
Console.log (XHR);
Console.log (Errorthrown);
}
Solve:
1. Do not use local 127.0.0.1 for the request address, instead of the native IP
2. The mobile phone must be connected to the computer's wift, and ensure that the connection is successful and the network is in good condition (bad network condition will also request failure)
Note: dataType: ' JSON ',
JSON must be uppercase, lowercase json seems to get no data. Very pit
problem Two: Ajax parsing JSON data
JSON data, if obtained from an interface, is the form of a string. You can use var mdata = eval (data) first; Encapsulated into JSON object form.
But some of the return is the form of the JSON object, do not need to encapsulate the direct use of the line. I'm not quite sure about that, but I have time to study it.
var mdata = eval (data);
var finallist= ';
for (i=mdata.length-1;i>=0;i--) {
finallist=finallist+ ' <li data-id= "' +i+ '" class= "Mui-table-view-cell" ><a class= "Mui-navigate-right" ><div class= "mui-media-body" > ' +mdata[i].title+ ' <p class= ' Mui-ellipsis "> ' +mdata[i].content+ ' </p></div></a></li> ';
}
problem Three: drop-down refresh can be used in the browser, real-machine debugging is not available
Cause Analysis: No double-webview mode is used, only the sub-interface can not implement the drop-down refresh on the real machine.
Official website: http://dev.dcloud.net.cn/mui/pulldown/