- <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>
来源: http://www.jianshu.com/p/8d5b14f618f8