This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12973|Reply: 0

[Vue] Vue uses this pointing issue in axios

[Copy link]
Posted on 12/26/2017 12:31:57 PM | | | |
Use vue to bind the data, and then display it on the interface, the data is requested from the interface through axios, and then assigned! ! First, post the code first!



Because, I couldn't bind the data with this, and then I printed this and found it to be undefined, as shown in the image above:

Workaround: You can use the arrow function "=>" to solve it. As follows:



This inside the arrow function "=>" in ES6 is a lexical scope, determined by the context (i.e. determined by the outer caller vue).








Previous:Traffic treasure box snap-up questions and answers
Next:html shows rectangles, rectangles, squares
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com