当前位置:   article > 正文

element UI默认选中table的第一行,高亮显示_layui表格默认点击第一行

layui表格默认点击第一行

要求:默认选中table的第一行,将其高亮显示

    <el-table
      ref="monthlyPlanTable"
      v-loading="listLoading"
      :data="tableData"
      stripe
      highlight-current-row
      style="width: 100%"
      @row-click="rowclick"
    >
      <el-table-column prop="projectCode" label="项目类型" align="center" :formatter="formatterProjectType" />
      <el-table-column prop="planMonth" label="计划月度" align="center" />
      <el-table-column prop="departId" label="组织名称" align="center" :formatter="formatterDepart" />
      <el-table-column prop="creater" label="制定人" align="center" :formatter="formatterCreater" />
      <el-table-column prop="createTime" label="制定日期" align="center" />
    </el-table>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

通过监听,设置表格的当前行。
tableDate 为表格的data列表值。

  watch: {
    tableData: function() {
      this.$nextTick(function() {
        this.$refs.monthlyPlanTable.setCurrentRow(this.tableData[0])
      })
    }
  },
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/114480
推荐阅读
相关标签
  

闽ICP备14008679号