Element Table常用设置:排序、自定义序列、列表汇总、设置斑马线

  •     //自定义斑马线
            
            
            
            
            
            
            
            
     
    export default {
        data(){
            return{
                tableData2: [{
                    date: '2016-05-02',
                    name: '王小虎',
                    account:2000
                }, {
                    date: '2016-05-04',
                    name: '王小虎',
                    account:1996.36
                }, {
                    date: '2016-05-01',
                    name: '王小虎',
                    account:10263.9
                }, {
                    date: '2016-05-03',
                    name: '王小虎',
                    account:862
                }],
                totalamount:15157.9,   //分页获取的汇总值
            }
        },
        methods:{
            tableRowClassName({row, rowIndex}) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },
            sortChange1(a,b) {  //排序
                return a.account-b.account
            },
            getSummaries1(param) {  //设置汇总
                const { columns, data } = param;
                const sums = [];
                columns.forEach((column, index) => {
                    sums[0]='汇总';
                    sums[2]=this.totalamount
                });
                return sums;
            },
            indexMethod(index) {  //设置序列号
                return 'row'+index;
            }
        }
    }

    Element Table常用设置:排序、自定义序列、列表汇总、设置斑马线_第1张图片

你可能感兴趣的:(Element,Ui相关基础设置)