antDesignOfVue 符合條件的表格復選框禁止選中


computed: {
 rowSelection() {
      const _this = this
      const { selectedRowKeys } = this
      return {
        selectedRowKeys,
        onChange: (selectedRowKeys) => {
          this.selectedRowKeys = selectedRowKeys
        },
        getCheckboxProps: (record) => ({
         props: {
             // 全部默認禁止選中
             // disabled: true,
             // 某幾項默認禁止選中(R: 當state等於1時)
             disabled: record.state === 1,
       // 某幾項默認選中(R: 當state等於1時)
       // defaultChecked: record.state == 1,
     },
    }),
   }
  },
},
 <a-table
  ref="table"
  size="middle"
  bordered
  rowKey="id"
 :columns="columns"
 :dataSource="dataSource"
:pagination="ipagination" :rowSelection="rowSelection" :loading="tableLoading" class="j-table-force-nowrap" > <!-- 操作 --> <template slot="action" slot-scope="text, record"> <router-link :to="{name: 'bulkDelivery', params: {id: record.id}}">發貨</router-link> </template>
</a-table>

查看效果:

 

 全選也不會被選中

 

 完美~~


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM