<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<table class="table table-hover">
<thead>
<tr>
<th>编号</th>
<th>电影名</th>
<th>评分</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="item of movies" :key="item._id">
<td v-for="i of item">{{i}}</td>
<td>
<button type="button" class="btn btn-danger">删除</button>
<button type="button" class="btn btn-warning">修改</button>
</td>
</tr>
</tbody>
</table>
</div>
<script>
new Vue({
el: "#app",
data: {
movies: []
},
mounted() {
$.ajax({
url: "http://localhost:8080/top250"
}).then(res => {
console.log(res.data);
this.movies = res.data
})
}
})
</script>
</body>
</html>