ant-design-vue table相关

基本常规的一些用法都能在官网上查到:https://www.antdv.com/components/table-cn/

以下是目前项目遇到的一些技能点,总结下记录下来

1、基础用法:

<template>
  <a-table 
    :columns="columns" 
    :data-source="data"
    :pagination="pagination" <!-- :pagination="false" 不分页 -->
    >
    <a slot="name" slot-scope="text">{
  { text }}</a>
  </a-table>
</template>
<script>
const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
    scopedSlots: { customRender: 'name' },
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
    width: 80,
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address 1',
    ellipsis: true,
  },
  {
    title: 'Long Column Long Column Long Column',
    dataIndex: 'address',
    key: 'address 2',
    ellipsis: true,
  },
  {
    title: 'Long Column Long Column',
    dataIndex: 'address',
    key: 'address 3',
    ellipsis: true,
  },
  {
    title: 'Long Column',
    dataIndex: 'address',
    key: 'address 4',
    ellipsis: true,
  },
];

const dataSource = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
    tags: ['nice', 'developer'],
  }
];
export default {
  data() {
    return {
      columns,
      dataSource,
      pagination: {
         pageNum: 1,
         pageSize: 50
      },
    };
  },
};
</script>

 2、向后台获取数据

getSourceData() {
    const params = {
        pageNum: this.pagination.pageNum,
        pageSize: this.pagination.pageSize,
        data: queryParams
    }
    getDataSource(params).then((res) => {  //封装好的axios请求
        if(res.code === 200){
            this.dataSo
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值