2.axios的使用.html 968 B

12345678910111213141516171819202122232425262728293031323334
  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. <link rel="stylesheet" href="common.css" />
  9. </head>
  10. <body>
  11. <div class="user-list">
  12. <table>
  13. <!-- thead标签给table定义表头 -->
  14. <thead>
  15. <tr>
  16. <th>头像</th>
  17. <th>姓名</th>
  18. <th>密码</th>
  19. <th>年龄</th>
  20. <th>性别</th>
  21. </tr>
  22. </thead>
  23. <tbody id="listBody">
  24. <!-- 动态添加数据 -->
  25. </tbody>
  26. </table>
  27. <button id="btn">获取数据</button>
  28. </div>
  29. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  30. <!-- 上面引入axios库后,会在全局对象上添加一个 axios 函数对象 -->
  31. <script src="2.js"></script>
  32. </body>
  33. </html>