el-table,:render-header

<template>
  <el-table :data="tabledata" style="width: 100%" border>
    <el-table-column prop="oldOrderBy" label="排序" :render-header="renderHeader">   
    </el-table-column>
    <el-table-column prop="productName" label="产品名称"></el-table-column>
  </el-table>
</template>
<script>
export default {
  data() {
    return {
      tabledata: [],
      isDragon:true
    };
  },
  created() {
    this.getTableData()
  },
  methods: {
    renderHeader(h, { column }) {
        return h('span', { style: { padding: '0' } }, 
         [
          h('span', { style: { paddingRight: '3px' } }, column.label),
          h('a', {
            style: { color: '#008AE1', fontSize: '12px' },
            on: { click: () => { this.isDragon = false } },
            props: { content: column.label },
          }, '编辑')
         ]
        )
    },
    getTableData() {
       this.tabledata = [{oldOrderBy:1,productName:'产品一'},
                         {oldOrderBy:2,productName:'产品二'}];
    },
  }
};
</script>

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐