ant design for vue 关于table的一些问题


 

1、为table添加分页: :pagination="pagination"

pagination: {
      defaultPageSize: 10,
      showTotal: (total) => `共${total} 条数据`,
      total: 0,
      showSizeChanger: true,
      pageSizeOptions: ['10', '20', '50'],
      onShowSizeChange: (current, pageSize) => {
        this.pageSize = pageSize;
        this.getTableData();
      },
      onChange: (page, pageSize) => {
        this.pageSize = pageSize;
        this.pageNum = page;
        this.getTableData();
      }

    },

2、为table添加序号:在columns中: 添加一行:  {"title": "序号",customRender: (value, row, index) => `${(this.pageNum-1)*10+index+1}`},
	/**pageNum 当前第几页*/

3、 为table添加编辑、删除功能
	<template slot="sensorId" slot-scope="text, record, index">
	    <span>
	      <a-button @click.native="editTableRow(record)" size="small" type="link">编辑</a-button>
	      <a-button @click.native="removeTableRow(record)" size="small" type="link">删除</a-button>
	    </span>
	</template>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM