Axios入门

html 复制代码
<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <script src="../ajax/axios-0.18.0.js"></script>

    <script src="../ajax/vue.js"></script>

</head>

<body>

    <div id="app">

        <table border="1" cellspacing="0" width="60%">

            <tr>

                <th>编号</th>

                <th>姓名</th>

                <th>用户名</th>

                <th>邮箱</th>

                <th>手机号</th>

                <th>网站</th>

                <th>城市</th>

            </tr>

            <tr align="center" v-for="(user, index) in emps">

                <td>{{index + 1}}</td>

                <td>{{user.name}}</td>

                <td>{{user.username}}</td>

                <td>

                   {{user.email}}

                </td>

                <td>{{user.phone}}</td>

                <td>

                    {{user.website}}

                </td>

  

                <td>

                    {{user.address.city}}

                </td>

            </tr>

                </table>

    </div>

</body>

</html>

  
  

<script>

    new Vue({

        el:"#app",

        data:{

            emps : []

        },

        mounted() {

            axios.get("https://jsonplaceholder.typicode.com/users").then(

                result => {

                    this.emps = result.data

                }

            )

        },

    })

</script>
相关推荐
郑州光合科技余经理18 分钟前
国际版外卖系统:税率字段怎么和订单主流程解耦
android·java·开发语言·前端·后端·php·ai编程
梦想平凡1 小时前
百游棋牌源代码开发搭建教程(十):隔离部署、备份恢复与双端验收
java·前端·javascript·数据库·源代码管理
yume_sibai2 小时前
06-Rust Web 开发实战(Axum 框架 + 数据库 + JWT 认证 + 中间件 + 部署)
前端·数据库·rust
计算机魔术师3 小时前
特朗普上台打给黄仁勋:AI末日论是骗局,我们绝不让它发生
前端
troy1283 小时前
Python 基础语法(八):Web 后端开发、数据分析与可视化、网络爬虫、人工智能 / 大模型应用
前端·python·数据分析
计算机魔术师4 小时前
CEO说要慢下来,黑客说别做梦了——同一篇论文,两种命运
前端
kyriewen4 小时前
我花3天抓了一个幽灵bug,凶手藏在第4层
前端·javascript·程序员
IT_陈寒5 小时前
Java里用Stream.parallel()翻车实录,这性能还不如单线程
前端·人工智能·后端
Bs_MoneyMagnet5 小时前
基于springboot+vue的生态果园采摘预约系统的设计与实现 源码+文档
java·vue.js·spring boot·后端·毕业设计·计算机毕业设计
wangchunyu1145 小时前
JavaScript 零基础入门教程
前端