Blame view

test/routers/table.vue 3.08 KB
f9f1865c   梁灏   Table columns add...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  <style>
      /*.ivu-table .demo-table-info-row td{*/
          /*background-color: #2db7f5;*/
          /*color: #fff;*/
      /*}*/
      /*.ivu-table .demo-table-error-row td{*/
          /*background-color: #ff6600;*/
          /*color: #fff;*/
      /*}*/
      .ivu-table .table-age-col{
          background: #ff6600;
      }
      .ivu-table .table-name-col{
          background: #2db7f5;
      }
      .ivu-table .table-address-col{
          background: #187;
      }
c211f717   梁灏   Table data suppor...
19
20
21
22
23
24
25
26
27
28
29
30
      .ivu-table .class-cell-age{
          background: #187;
          color: #fff;
      }
      .ivu-table .class-cell-address{
          background: #f60;
          color: #fff;
      }
      .ivu-table .class-cell-name{
          background: #2db7f5;
          color: #fff;
      }
f9f1865c   梁灏   Table columns add...
31
  </style>
2cb8a6d9   梁灏   commit Table comp...
32
  <template>
f9f1865c   梁灏   Table columns add...
33
      <i-table :row-class-name="rowClassName" :columns="columns1" :data="data1"></i-table>
2cb8a6d9   梁灏   commit Table comp...
34
35
36
  </template>
  <script>
      export default {
2cb8a6d9   梁灏   commit Table comp...
37
38
          data () {
              return {
f9f1865c   梁灏   Table columns add...
39
                  columns1: [
3d6fa54b   梁灏   update Table
40
                      {
c211f717   梁灏   Table data suppor...
41
42
43
44
45
                          type: 'selection',
                          width: 60,
                          align: 'center'
                      },
                      {
3d6fa54b   梁灏   update Table
46
47
                          title: '姓名',
                          key: 'name',
c211f717   梁灏   Table data suppor...
48
49
  //                        fixed: 'right',
  //                        className: 'table-name-col'
3d6fa54b   梁灏   update Table
50
51
52
53
                      },
                      {
                          title: '年龄',
                          key: 'age',
c211f717   梁灏   Table data suppor...
54
55
  //                        fixed: 'right',
  //                        className: 'table-age-col'
3d6fa54b   梁灏   update Table
56
57
58
                      },
                      {
                          title: '地址',
f9f1865c   梁灏   Table columns add...
59
                          key: 'address',
c211f717   梁灏   Table data suppor...
60
  //                        className: 'table-address-col'
3d6fa54b   梁灏   update Table
61
62
63
64
65
66
                      }
                  ],
                  data1: [
                      {
                          name: '王小明',
                          age: 18,
c211f717   梁灏   Table data suppor...
67
68
69
70
71
                          address: '北京市朝阳区芍药居',
                          cellClassName: {
                              age: 'class-cell-age',
                              address: 'class-cell-address'
                          }
3d6fa54b   梁灏   update Table
72
73
74
75
76
77
78
79
80
                      },
                      {
                          name: '张小刚',
                          age: 25,
                          address: '北京市海淀区西二旗'
                      },
                      {
                          name: '李小红',
                          age: 30,
c211f717   梁灏   Table data suppor...
81
82
83
84
                          address: '上海市浦东新区世纪大道',
                          cellClassName: {
                              name: 'class-cell-name'
                          }
3d6fa54b   梁灏   update Table
85
86
87
88
89
90
                      },
                      {
                          name: '周小伟',
                          age: 26,
                          address: '深圳市南山区深南大道'
                      }
f9f1865c   梁灏   Table columns add...
91
                  ]
50637863   梁灏   update DatePicker
92
93
94
              }
          },
          methods: {
f9f1865c   梁灏   Table columns add...
95
96
97
98
99
100
101
              rowClassName (row, index) {
                  if (index === 1) {
                      return 'demo-table-info-row';
                  } else if (index === 3) {
                      return 'demo-table-error-row';
                  }
                  return '';
2cb8a6d9   梁灏   commit Table comp...
102
              }
2cb8a6d9   梁灏   commit Table comp...
103
104
          }
      }
d0e206c5   梁灏   Table add content...
105
  </script>