<template>
<div>
<h3>学生信息表</h3>
<table id="customers">
<tr> <th>ID</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
</tr>
<tr v-for="item in list" :key="item.id">
<td>{
{item.id}} </td>
<td>{
{item.name}}</td>
<td>{
{item.age}}</td>
<td>{
{item.sex}}</td>
</tr>
</table>
</div>
</template>
<script>
import axios from 'axios'
export default {
data() {
return {
list: []
}
},
created(){
// 2、通过axios发送请求
// get类型
// axios.get('https://api.i-lynn.cn/college?page=4').then((res) => {
// axios.get(url,配置项)
axios
.get('http://localhost:
通过axios发送GET请求,可以请求之前的nodejs接口,将返回的数据渲染到页面上
最新推荐文章于 2023-10-31 12:40:26 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)