2020-08-27 17:18:57 +08:00

2.6 KiB

<template>
    <Wb-table :data="data" no-data-text="暂无数据" @on-tr-click="trClick" @on-td-click="tdClick">
       <Column type="expand">
           <template slot-scope="props">
               <Row>
                   <Cell span="8">
                       <span>{{ props.name }}</span>
                   </Cell>
                   <Cell span="8">
                       <span>{{ props.age }}</span>
                   </Cell>
                   <Cell span="8">
                       <span>{{ props.delay }}</span>
                   </Cell>
               </Row>
           </template>
       </Column>
       <Column :filter="formatDate" :detail-component="component" prop="date" name="日期" />
       <Column :detail-component="component" prop="name" name="姓名" />
       <Column :detail-component="component" prop="age" name="年龄" />
       <Column prop="adr" name="地址" />
       <Column :filter="status" prop="status" name="状态" />
   </Wb-table>
</template>
<script>
    export default {
        data: function(){
            return {
                status: [{
                    value : 1,
                    text : "黄铜"
                },{
                    value : 2,
                    text : "白银"
                },{
                    value : 3,
                    text : "黄金"
                },{
                    value : 4,
                    text : "铂金"
                }],
                data: [{
                    name: "张晓刚",
                    age: 24,
                    date: new Date(2016, 9, 10),
                    adr: "北京市海淀区西二旗",
                    status: 1
                }, {
                    name: "李晓红",
                    age: 26,
                    date: new Date(2016, 9, 11),
                    adr: "北京市海淀区西二旗",
                    status: 2
                }, {
                    name: "隔壁老王",
                    age: 22,
                    date: new Date(2016, 9, 12),
                    adr: "北京市海淀区西二旗",
                    status: 3
                }, {
                    name: "我爸是李刚",
                    age: 19,
                    date: new Date(2016, 9, 13),
                    adr: "北京市海淀区西二旗",
                    status: 4
                }],
            }
        },
        methods: {
            formatDate: function (data) {
                var year = data.getFullYear();
                var m = data.getMonth();
                var date = data.getDate();
                return year + "-" + m + "-" + date
            }
        }
    }
</script>