elementui 表格中嵌套子表格

                :default-expand-all="false" :row-class-name="getRowClass" style="width: 100%">

                

                    

                        0" border

                            :header-cell-style="{background:'#eef1f6',color:'#606266'}" :data="scope.row.children"

                            style="width: 100%">

                            

                            

                            

                            

                            

                        

                    

                

                

                

                

                

                

            

         apply_form_table: [{

                    name: '签字笔',

                    num: '2',

                    unit: '2',

                    unit_price: '2',

                    total_price: '2',

                    children: []

                }, {

                    name: '签字笔',

                    num: '2',

                    unit: '2',

                    unit_price: '2',

                    total_price: '2',

                    children: [{

                        name: '签字笔',

                        num: '2',

                        unit: '2',

                        unit_price: '2',

                        total_price: '2',

                    }, {

                        name: '签字笔',

                        num: '2',

                        unit: '2',

                        unit_price: '2',

                        total_price: '2',

                    }]

                }]

        methods: {

            //  判断表格中的子表格是否有数据,有就显示,无就不显示

            getRowClass({

                row,

                rowIndex

            }) {

                if (row.children.length == 0) {

                    return 'row-expand-cover';

                } else {

                    return '';

                }

你可能感兴趣的:(elementui 表格中嵌套子表格)