1. 程式人生 > 其它 >ant-design-vue 中table簡單用法

ant-design-vue 中table簡單用法

   <a-table 
    bordered  
    :columns="columns" 
    :data-source="data"
    :pagination="pagination">
  <template #action = {record,index}>
   .......//record 就表示表格裡面某一行的的所有資料了
  </template>
</a-table> columns: [ { title: '姓名', dataIndex: 'name', key: 'name', }, { title: '年齡', dataIndex: 'age', key: 'age', }, { title: '住址', dataIndex: 'address', key: 'address',slots: {customRender:'action [自定義隨便起]'} }, ],
data: [ { key:
'1', //這裡需要加上 key 值,不然後報錯 下面的data中 name 要與上面的dataIndex 相對應 若需要在表格中加上自定義的內容 則需要在 name: '胡彥斌', age: 32, address: '西湖區湖底公園1號', }, { key: '2', name: '胡彥祖', age: 42, address:
'西湖區湖底公園1號', }, ],