• Ant Design of Vue table表格 点击一行选中效果 One'_


    点击一行并选中(可获取该行数据),改变颜色 

        <s-table
            ref="table"
            rowKey="key"
            bordered
            :columns="columns"
            :data="loadData"
            showPagination="auto"
            :customRow="customRow"
            :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }"
          >
            <span slot="serial" slot-scope="text, record, index">
              {{ index + 1 }}
            </span>
          </s-table>
      computed: {
        rowSelection () {
          return {
            selectedRowKeys: this.selectedRowKeys,
            onChange: this.onSelectChange
          }
        }
      }
        customRow (record, index) {
          return {
            on: {
              click: (e) => {
                console.log(record, index)
                this.selectedRowKeys = [index]
                this.selectedRows = [record]
              }
            }
          }
        },
        onSelectChange (selectedRowKeys, selectedRows) {
          this.selectedRowKeys = selectedRowKeys
          this.selectedRows = selectedRows
        },
  • 相关阅读:
    CodeForces
    设计模式之装饰模式和代理模式区别与联系
    java反射 概念
    Java 反射详解 转载
    Spring--AOP 例子
    MD5加密
    面向对象编程思想(OOP)
    软件测试assert
    junit4.9测试用例 spring测试用例 Assert 注解
    断言
  • 原文地址:https://www.cnblogs.com/caoxwen/p/13936908.html
Copyright © 2020-2023  润新知