vue.js填充数据到table表格的方法:【async getData(id) {const res = await this.$store.api.newReq('/xxx/xxx/xxx/' + id).get();if (...】。

本文操作环境:windows10系统、vue.js 2.9、thinkpad t480电脑。
使用vue循环遍历Json数据,然后将数据填充到Table表格中。
展示代码:
async getData(id) {
const res = await this.$store.api.newReq('/xxx/xxx/xxx/' + id).get();
if (res.code === 0) {
this.data = res.data;
}
},定义变量:
立即学习“前端免费学习笔记(深入)”;
data: {
base: {},
baseList:[],
},table表格展示:
| ID | 文章id | 分类名称 | 分类等级 | 创建时间 |
|---|---|---|---|---|
效果图如下:

推荐学习:php培训










