<! DOCTYPE html><body> <div id= "app" >
<script> New Vue ({el: "#app", Data: {msg: "", Title: "Axios Explanation"}, Mounted:function () {axios.interceptors.request . Use (Function (config) {console.log ("request"); return config;}) axios.interceptors.response.use (function (response) {Console.log ("reques11t"); return response;}) }, Methods: {get:function () {axios.get ("Package.json", {params: {userId: "999", Page:5}, headers: {toKen: ' Jack ', SB: ' AAA '}, Before:function () {Console.log ("before AAA");}). Then (res-= {this.msg = Res.data;}). catch (function (error) {Console.log ("error init" + Error)})}, Post:function () {axios.post ("Package.1.json", {userId: 888}, {headers: {toKen: "Tom"}}). Then (res = {this.msg = Res.data})}, Http:function () {axios ({URL: ' package. JSON ", Method:" Get ", data: {userid:11}, params: {userId:" 999 ", Page:5}, headers: {toKen: ' Http-test '}}). Then (re s = = {this.msg = Res.data})}}) </script></body>
Package.json
{ "result": [ ["Female Sweatshirt","4716267"], ["Sweatshirt 2017 New female","26439903"], ["Sweatshirt Man","11965219"], ["Sweatshirt Female Korean version of the student loose BF ulzzang","1646428"], ["The autumn of the girl in sweatshirt clothes","17412913"], ["Sweatshirt Women Loose","1809463"], ["Sweatshirt Oversize","1717961"], ["Hooded Female Hooded Sweatshirt","23678431"], ["Wei Yinan Hooded","6375964"], ["Sweatshirt Slim","2550625"] ]}
Need to open a static server such as with F2e-server or Express | | KOA | | Tomcat | | Nginx | | Apache, pick one.
I like to use F2e-server.
Axios explanation and Vue building use