In the host Dian after the system, I chose Vue-resource this plug-in as a communication tool with the server, but heard the front-end peer said Vuejs2.0 has not been in maintenance Vue-resource, vuejs2.0 has used Axios. Because I just vux this UI component. And Vux's Ajaxplugin plug-in uses Axios. Do not feel particularly wasteful Axios, and must also be used Axios later. So I decided to replace the current vue-resource with the Vux ajaxplugin.
Vux official documents are also very clear and easy to use, have been integrated and vue-resource the same as
Make the following changes directly in Main.js
Then there was the problem of JSON data not accepting, so I went to ask people to see how others solved it.
There is a front-end friend called me to use the arrow function, I did not quite understand how to change at first, then know that he said the arrow function is Vue http another way of writing, is to change the traditional writing to lambda, such as a comparison of the red label. Will know. In this way, I changed everything to this, and it worked.
The next step is Axios's interceptor problem, which has been reported that the connection failed, and then did not have Ajax success. No Ajax success do not say interception, and then to ask people, at the outset, some people said it is this point, because Axios is not Vuejs plug-in, but the third-party Ajax plug-in, in fact, is not axios the interceptor problem, it is true that the vuejs of their own foundation is not solid. Finally, this point is wrong. The code is as follows
Later asked the friend, said to change this to Vue to try, sure enough, such as:
The problem is a lot of time is the direction of the wrong, has been turning, Baidu also said to use the original use of Axios. So I studied, or there was a problem. In fact, the root is not resolved how to change is wrong, there is no straight in the key point. Recently found that there is no problem, or is a problem to half a day or even one. But always return good, is solved, should also be a little harvest, the only thing to remember is to solve the problem must be straight in the key points. Otherwise the direction farther and farther, the problem has not solved. Must study hard, solid foundation.
On the process of transforming Vue-resource into Axios