zoukankan      html  css  js  c++  java
  • antd vue tablelist 模板

    <template>
    
      <a-table :columns="columns" :data-source="data" :scroll="{ x: 1300,y:1500}" class="tb_list" ref="table"
            :pagination="{
              current: table.pageNumber,
              defaultPageSize: 10,
              showSizeChanger: true,
              pageSizeOptions: ['10', '20', '30', '40'],
              showTotal: (total,range) => `共${total}条`,
              onShowSizeChange: (current, pageSize) =>{table.pageSize = pageSize; table.pageNumber = 1},
              onChange: (pageNumber) => table.pageNumber = pageNumber
          }"
          :row-selection="rowSelection"
          :rowKey="record=>record.id"
      >
    
      <span slot="action" slot-scope="text, record" class="sup">
        <a-button type="link" @click="showModal(record)">Edit</a-button>
        <!-- <a-divider type="vertical" /> -->
    
        <a-button type="link">Delete</a-button>
      </span>
      </a-table>
    
    </template>
          
    
    <script>
    
    
    
    const columns = [
      { title: 'id', dataIndex: 'id', key: 'id',  150,},
      { title: '地址', dataIndex: 'address', key: 'address' , 150},
      { title: 'age', dataIndex: 'age', key: 'age', 150 },
      { title: 'name', dataIndex: 'name', key: 'name', 150 },
    
      {title: 'operate',key: 'operation',fixed: 'right', 'auto',scopedSlots: { customRender: 'action' },
      },
    ];
    
    const data = [
      {
        id: '1',
        name: 'John Brown',
        age: 32,
        address: 'New York Park',
      },
      {
        id: '2',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '3',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '4',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '5',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '6',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '7',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '8',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '9',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '10',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
      {
        id: '11',
        name: 'Jim Green',
        age: 40,
        address: 'London Park',
      },
    ];
    
    const rowSelection = {
      onChange: (selectedRowKeys, selectedRows) => {
        console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
      },
      onSelect: (record, selected, selectedRows) => {
        console.log(record, selected, selectedRows);
      },
      onSelectAll: (selected, selectedRows, changeRows) => {
        console.log(selected, selectedRows, changeRows);
      },
    };
    
    export default {
      name:'tablelist',
      data() {
        return {
          // visible: fasle,
          data,
          columns,
          table:{
          pageNumber:1,
          pageSize:10
      },
      rowSelection
        };
      },
      methods: {
        // editchange(record){
        //   console.log(record.id+"  "+record.name+" ",record.age);
        // },
        showModal(record) {
          this.visible = true;
          console.log(record.id+"  "+record.name+" ",record.age);
        },
        handleOk(e) {
          console.log(e);
          this.visible = false;
        },
      }
    };
    </script>
    <style lang="less" scoped>
    .sup{
      margin-left: -13px;
      
    }
    </style>
    

      

  • 相关阅读:
    my eye
    html与HTML5的区别
    h5css样式
    h5css3弹性盒子
    简单js的介绍
    2020.8.16(周报6)
    2020.8.18
    2020.8.20
    2020.8.17
    2020.8.15
  • 原文地址:https://www.cnblogs.com/SunshineKimi/p/14714199.html
Copyright © 2011-2022 走看看