vue antd table title 动态修改

  • Post author:
  • Post category:vue


 <a-table rowKey="id" bordered
               :dataSource="dataSource"
               :columns="columns" :pagination="ipagination" :loading="loading" 			@change="handleTableChange">
              <span slot="serial" slot-scope="text,record,index">
               {{(ipagination.current-1)*ipagination.pageSize+index+1}}
              </span>
        <span slot="action" slot-scope="text, record">
          <a @click="assess(record)" v-if="!queryParam.hasAssess">考核</a>
          <span v-else>{{record.score}}</span>
        </span>
        <template slot="titleScore">
          <span v-if="queryParam.hasAssess">分数</span>
          <span v-else>操作</span>
        </template>
      </a-table>
columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 80,
            align: 'center',
            scopedSlots: { customRender: 'serial' },
            fixed: 'left'
          },
          {},
          {
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 100,
            scopedSlots: { customRender: 'action',title:'titleScore' }
          }
        ],

使用列的 scopedSlots 属性

scopedSlots: { customRender: ‘action’,title:‘titleScore’ }



版权声明:本文为wyljz原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。