Summary of issues encountered by MUI

Source: Internet
Author: User
Tags eval exception handling json

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/







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.