当前位置:   article > 正文

Axios中params和data的区别_axios params

axios params

1、params的用法

a、前端页面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <base href="http://localhost:8080/myssm01/">
</head>
<body>

<button onclick="click01('get')">get请求</button>
<button onclick="click01('post')">post请求</button>
<button onclick="click01('put')">put请求</button>
<button onclick="click01('delete')">delete请求</button>
</body>

<script>
    function click01(med) {
     
        axios({
     
            method:med,
            url:'tes',
            params: {
     
                name:'楠小弟',
                age:12
            }
        }).then(function (rs) {
     
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/924604
推荐阅读
相关标签
  

闽ICP备14008679号