使用element-table很简单,设置key,data等参数即可data为数组遍历结果为scope.row对象
<template>
<el-table
:data="tableData"
>
<el-table-column
label="标题">
<template slot-scope="scope">
<span>{{ scope.row.title}}</span>
</template>
</el-table-column>
<el-table-column
label="ID">
<template slot-scope="scope">
<span>{{ scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column>
<template slot-scope="scope">
<el-button @click="TellMeId(scope.row.id)">TellMe</el-button>
</template>
</el-table-column>
</el-table>
...
</template>
...
<script>
export default{
data(){
return{
tableData:[]
}
},
methods:{
TellMeId(num){
console.log(num)
}
}
}
...
本文介绍如何使用 Element UI 的 Table 组件展示数据,并通过示例代码详细解释了如何配置表格列、显示数据及实现按钮点击事件。
2893

被折叠的 条评论
为什么被折叠?



