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>
相关推荐
Baklib梅梅22 分钟前
探码科技再获“专精特新”认定:Baklib引领AI内容管理新方向
前端·ruby on rails·前端框架·ruby
南方以南_28 分钟前
Chrome开发者工具
前端·chrome
YiHanXii35 分钟前
this 输出题
前端·javascript·1024程序员节
楊无好41 分钟前
React中ref
前端·react.js
维他命Coco41 分钟前
js常见开发学习
javascript
程琬清君43 分钟前
vue3 confirm倒计时
前端·1024程序员节
麦麦大数据44 分钟前
F033 vue+neo4j图书智能问答+知识图谱推荐系统 |知识图谱+neo4j+vue+flask+mysql实现代码
vue.js·flask·nlp·neo4j·智能问答·图书·1024程序员节
歪歪1001 小时前
在C#中详细介绍一下Visual Studio中如何使用数据可视化工具
开发语言·前端·c#·visual studio code·visual studio·1024程序员节
唔661 小时前
flutter实现web端实现效果
前端·flutter
csj501 小时前
前端基础之《React(2)—webpack简介-使用Babel》
前端·react