index.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <script src="./src/index.js"></script>
  9. </head>
  10. <body>
  11. <script>
  12. /**
  13. * 1、函数功能
  14. */
  15. // axios({
  16. // methods:'',
  17. // url:'',
  18. // params:{},
  19. // data:{}
  20. // }).then(res=>{
  21. // console.log(res)
  22. // })
  23. // axios.get().then()
  24. // axios.post().then()
  25. // axios.put().then()
  26. // axios.delete().then()
  27. /**
  28. * 2、axios函数封装
  29. */
  30. axios({
  31. method:'POST',
  32. url:'https://api.apiopen.top/getJok',
  33. params:{
  34. a:1,
  35. b:2
  36. },
  37. data:{
  38. c:3,
  39. d:4
  40. }
  41. }).then(res=>{
  42. console.log(res)
  43. }).catch(reason=>{
  44. console.log(reason)
  45. })
  46. </script>
  47. </body>
  48. </html>