plugin/element.js文件中:
import Vue from 'vue'
import {
Table,
TableColumn
}
Vue.use(Table)
Vue.use(TableColumn)
Vue模板文件中:
<el-table :data="userlist" border stripe>
<el-table-column type="index"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
</el-table>
解释:
:data="userlist": 绑定数据域 许多对象组成的数组
border: 添加边框
stripe: 添加隔行变色
type="index": 索引行
label="姓名" prop="username" :label表示每列标题 prop表示绑定数据域数组中的每个对象中的属性值