欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

VUE开发笔记

程序员文章站 2022-03-13 21:33:45
1、GET单个参数请求示例//跨域配置代码段proxyTable: { "/apis": { target: "http://pv.sohu.com", secure: false, changeOrigin: true, pathRewrite: { "^/apis": "" } }, "/api": { target: "http://local...

1、GET单个参数请求示例

//跨域配置代码段
proxyTable: {
      "/apis": {
        target: "http://pv.sohu.com",
        secure: false,
        changeOrigin: true,
        pathRewrite: {
          "^/apis": ""
        }
      },
      "/api": {
        target: "http://localhost:9001/api",
        secure: false,
        changeOrigin: true,
        pathRewrite: {
          "^/api": "/"
        },
      },

    },
//vue.js代码片段
agetClick(){
  let paramss= {  
            count: 100
        }
      axios
        .get("api/Visit/RequestGET", {paramss}, {
              timeout: 1000
            })
        .then(res => {
          this.$message({
              message: res,
              type: "success"
            });
        })
        .catch(ex => {
          /*
          if ((ex.data.ErrMsg == null) | (res.ErrMsg == "")) {
            res.ErrMsg = "发送失败";
          }*/
          this.$message({
            message:"异常信息",
            type: "error"
          });
        });     
      },

2、POST请求

      //混合参数请求
      let para = [
        {
          TaskNo: getGuidGenerator(),
          Params: [{ Name: "wait_state", Value: "2" }]
        }
      ];

      // "继续下送货任务
      axios
      .post("http://10.177.104.69:9999/api/fms/addTask", para)
//单个实体类型参数请求示例
agetClick(){
        let visit = {
        id: 0,
        cip: "192.168.5.999",
        cid: 320500,  
        cname: "江苏省苏州市",
        updatetime: "2016-6-6",
        amount: 1,
        equipment: "Goole Chrome",
        system: "Windows10",
        }
      axios
        .post("api/Visit/SetVisit", visit)
        .then(res => {
          this.$message({
              message: res.data,
              type: "success"
            });
        })
        .catch(ex => {
          this.$message({
            message:"异常信息",
            type: "error"
          });
        });     
      },

3、vue定义全局变量和全局方法https://segmentfault.com/a/1190000015842187

4、统计网站访问IP信息【https://www.cnblogs.com/JimShi/p/11302384.html

5、统计网站页面访问量、vue项目中统计页面访问量PV UV【https://www.jianshu.com/p/395650e6b5b2

本文地址:https://blog.csdn.net/Elegant_Kevin/article/details/110675152

相关标签: vud.js