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