el-table header fixed fixed column customization (add button event)

<!--在要自定义的el-table-column里 添加 render-header函数 -->
<el-table-column
      fixed="right"
      width="120"
      :render-header="renderBtn">
      <template slot-scope="scope">
           <div style="background: #063b6c; width: 120px">
               <el-button
                   @click.native.prevent="heigthPoint( scope.row)"
                    type="text"
                    size="small">高亮
               </el-button>
               <el-button
                   @click.native.prevent="flyToPoint( scope.row)"
                   type="text"
                    size="small">跳转
                </el-button>
                <el-button
                   @click.native.prevent="detialRow( scope.row)"
                   type="text"
                   size="small">详情
                 </el-button>
              </div>
                            
         </template>
</el-table-column>
methods: {

    //定义自定义表头
     renderBtn(){
        return (
            <div><el-button onClick={this.allHighClick} type="text" size="mini"> {this.fixedHighFlag ==0 ? '全部高亮' : '取消'}</el-button></div>
            )
        },
   //点击事件
    allHighClick(){console.log(1)},
},

Effect

''Highlight All'' is a button click event.

 

Guess you like

Origin blog.csdn.net/weixin_44220845/article/details/120866656