-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathaxios
38 lines (36 loc) · 879 Bytes
/
axios
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lange="en">
<head>
<meta charset="UTF-8"/>
<title>Title</title>
<script src="../己vue/vue.js"></script>
<script src="axios.js"></script>
</head>
<body>
<div id="app">
<button @click="getTeacherList">get all teachers</button>
<table>
<tr v-for="item in teacherList">
<td>{{item.id}}</td>
<td>{{item.name}}</td>
</tr>
</table>
</div>
<script>
new Vue({
el: '#app',
data: {
teacherList: []
},
methods: {
getTeacherList() {
axios.get('http://localhost:8110/admin/edu/teacher').then(response => {
console.log(response)
this.teacherList = response.data.data.items
})
}
}
})
</script>
</body>
</html>