• vue axios


    axios 使用post传参

    1.后台接收JavaBean格式

    方法一:let adminInfo=JSON.parse(JSON.stringify(list));//需要转成json对象
                http({
                  url: '/dic-code/edit',
                  method: 'post',
                  headers:{
                    ContentType: 'application/json;charset=UTF-8'  //这里加上头部信息
                  },
                  data:adminInfo,
                }).then(res => {
                })
    方法二:
    http.post('/dic-code/save',
              adminInfo,
              {
                headers:{
                  'Content-Type': 'application/json;charset=UTF-8'  //这里加上头部信息
                }
              }
              ).then(res => {
                this.getMenu();
              })
    2.后台只接受一个字符串
    http({
                  url: '/dic-code/del',
                  method: 'post',
                  headers:{
                    ContentType: 'application/json;charset=UTF-8'  //这里加上头部信息
                  },
                  params:{id:this.treeId},
                }).then(res => {
                  console.log(res);
                  this.getMenu();
                })
  • 相关阅读:
    201141 live the lie until the lie becomes your life
    my php & mysql FAQ
    suger日料财务
    python 应用thrift thrift的监控fb303
    cherryPy学习
    my linux FAQ
    Javascript无阻塞加载方法
    设计模式学习笔记之组合模式模式
    【转】cookie
    C# 多线程
  • 原文地址:https://www.cnblogs.com/brillant/p/15762533.html
Copyright © 2020-2023  润新知