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>
相关推荐
GIS之路2 小时前
GDAL 实现影像裁剪
前端·python·arcgis·信息可视化
AGMTI2 小时前
webSock动态注册消息回调函数功能实现
开发语言·前端·javascript
码界奇点2 小时前
基于SpringBoot+Vue的前后端分离外卖点单系统设计与实现
vue.js·spring boot·后端·spring·毕业设计·源代码管理
不会Android的潘潘2 小时前
受限系统环境下的 WebView 能力演进:车载平台 Web 渲染异常的根因分析与优化实践
android·java·前端·aosp
建军啊2 小时前
java web常见lou洞
android·java·前端
阳无2 小时前
宝塔部署的前后端项目从IP访问改成自定义域名访问
java·前端·部署
Galloping-Vijay2 小时前
解决 WSL2 + Windows Hosts + 开启 VPN 后无法访问本地 Web 服务的问题
前端·windows
不吃香菜的猪2 小时前
使用@vue-office/pdf时,pdf展示不全
javascript·vue.js·pdf
wuhen_n2 小时前
TypeScript的对象类型:interface vs type
前端·javascript·typescript
见路不走!2 小时前
后端返回Blob文件流,前端实现导出
前端