<template>
  <div>
    <custom-table :col="col" :data="data" :span-method="arraySpanMethod" />
  </div>
</template>

<script>
import CustomTable from '@/components/CustomTable'
/*

 */
export default {
  components: {
    CustomTable
  },
  data() {
    return {
      col: [
        {
          prop: 'date',
          label: '日期'
        },
        {
          label: '配送信息',
          children: [
            {
              prop: 'name',
              label: '姓名'
            },
            {
              label: '地址',
              children: [
                {
                  prop: 'province',
                  label: '省份'
                },
                {
                  prop: 'city',
                  label: '市区'
                },
                {
                  prop: 'address',
                  label: '地址'
                }
              ]
            }
          ]
        }
      ],
      data: [
        {
          date: '2016-05-03',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          span: [
            [1, 2], [1, 0], [2, 1], [1, 1], [1, 1]
          ]
        },
        {
          date: '2016-05-02',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          span: [
            [1, 1], [1, 1], [0, 1], [1, 1], [1, 1]
          ]
        }
      ]
    }
  },
  methods: {
    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
      return row.span[columnIndex]
    }
  }
}
</script>
<style>
</style>
