1.0.0 • Published 2 years ago

guesswhy-reaper-axios v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

guesswhy-reaper-axios

···

⬇️ Install

npm install  guesswhy-reaper-axios

🎨 Usage

At first ,this is an axios with loading and  easy use 
don't forget :
one:import element-ui in main.js
two:change  headers and token in guesswhy-reaper-axios.js


Secondly,in vue.config.js
modole.export={
devServer: {
    proxy: {
      "/api": {
        target: "http://kg.zhaodashen.cn/mt/admin",//for example,you should use your own http:XXXX....
        changeOrigin: true,// if Origin?
        secure: false, // close SSL https should be true
        pathRewrite: {
          "^/api": "", 
        },
      },
      //....
    },
  },
}
Third:create a new js


import http from "@guesswhy-reaper-axios.js";
export const getUsersHistoryApi = (params) => 
  return http({
    method: "get",
    url: "users/history.jsp",//use you adress
    // params: {
    //   pagenum: 1,
    //   pagesize: 10,
    //   start_time: "",
    //   end_time: "",
    //   uname: "",
    // },
    // params: params,
    params,
  });
};


Fourth:
import { getUsersHistoryApi } from "js";//this js(name) is create by yourself and getUserHistoryApi can change
     getUsersHistoryApi(this.params).then((res) => {
        this.tableData = res.data.list; //for example
        this.tableDataTotal = parseInt(res.data.total);//for example
      });
    },
  },
  
Fifth:Don't forget :
  data() {
    return {
      // ...
      params: {
        pagenum: 1,
        pagesize: 5,
        start_time: "",
        end_time: "",
        uname: "",
        date: [],
      },
      tableData: [],

💡 Compiles and minifies for production

you can download guesswhy-reaper-axiox2 to get easily

按钮

### 🔒 License
See [Configuration Reference](https://cli.vuejs.org/config/).