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>
相关推荐
光影少年19 分钟前
vite+rust生态链工具链
开发语言·前端·后端·rust·前端框架
skywalk816320 分钟前
当前有什么流行的lisp的web框架吗?
开发语言·前端·lisp
IT_陈寒25 分钟前
为什么我的JavaScript变量老是不听使唤?
前端·人工智能·后端
HookJames28 分钟前
设计Section 06 · Component Sourcing & BOM Risk Control
前端
zhenxin012229 分钟前
HTML头部元信息避坑指南
前端·html
布局呆星41 分钟前
Vite代理解决前端跨域问题 | fetch请求 | 环境变量
前端
sghuter1 小时前
HTML头部元信息避坑指南
c语言·前端·html·cocoa
无心使然云中漫步1 小时前
Openlayers调用ArcGis地图服务之三 —— 要素查询(/query)
前端·arcgis·vue·数据可视化
薛定谔的猫19821 小时前
gradio学习代码部分
java·前端·javascript
yqcoder1 小时前
React 深度解析:类组件 (Class) vs 函数组件 (Function)
前端·javascript·react.js