Vue.js专区Web前端之路

vue-在table组件的render中添加事件

2019-08-27  本文已影响0人  Vivian_0430
<template>
<div>
  <a-table :columns="columns" />
</div>
</template>
<script>
export default {
  data() {
      columns:[
        {
          title: '操作',
          align: 'center',
          dataIndex: 'action',
          customRender: (text, record, index) => {
            const delete =()=>{
              this.handleDel(record.id);  //调用method里面的方法
            }
            let content = (<a-button  onClick={ delete }></a-button>); 
            const obj = {
              children: content,
              attrs: { colSpan: 1 },
            };
            return obj;
          } 
        }
      ]
  }
}
</script>
上一篇 下一篇

猜你喜欢

热点阅读