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>
相关推荐
martindelophy5 分钟前
Codex Chrome 插件 + Timeline Studio:构建可编辑的 AI 视频剪辑 Agent 工作流
前端·人工智能·chrome
whyutianict_vv41 分钟前
从 Web 前端到 HarmonyOS ArkTS:一次 AI 鸿蒙全栈智能体开发的迁移实录
前端·人工智能·harmonyos
qziovv1 小时前
前端转flutter——项目架构、初始化
前端·flutter
Ali885201 小时前
Python字符串方法速查表大全
前端·python
前端_刘师兄2 小时前
FAE工程师学习路线-进程
前端
冰暮流星2 小时前
javascript之webstorage用法
开发语言·javascript·ecmascript
执子念的飞鱼2 小时前
浏览器直接预览 Pages、Numbers、Keynote:iWork 格式真正难在哪
前端·javascript
alloc2 小时前
从延迟聚合到可解释诊断:MetricKit 的原理与工程化实践
前端
颜进强2 小时前
06 - OpenSpec change 从模糊想法到完整契约:new change / explore / propose 三连
前端·后端·ai编程
Cache技术分享2 小时前
499. Java 反射 - 获取类型上的注解
前端·后端