vue element table

el-table绑定数据框数据
el-table-column绑定key
template slot-socpe用来接收该行的数据,用来定制化一些操作

<template>
  <!--data绑定整个列表-->
  <el-table
    :data="tableData"
    style="width: 100%">
    <!--prop用来绑定列明,对应对象的key-->
    <el-table-column
      prop="name"
      label="姓名"
      width="180">
    </el-table-column>
    <!--使用template的slot-scope来接收当前行的数据,用来定制化数据,比如取年份-->
    <el-table-column
      label="详细数据">
      <template slot-scope="scope">
        {{scope.row}}
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: 'Home',
  data () {
    return {
      tableData: [{
        name: '王小虎',
        state: true
      }, {
        name: '王小虎',
        state: false
      }]
    }
  }
}
</script>
<style scoped>

</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值