Blame view

test/routers/table.vue 2.37 KB
f9f1865c   梁灏   Table columns add...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  <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;
      }
  </style>
2cb8a6d9   梁灏   commit Table comp...
20
  <template>
f9f1865c   梁灏   Table columns add...
21
      <i-table :row-class-name="rowClassName" :columns="columns1" :data="data1"></i-table>
2cb8a6d9   梁灏   commit Table comp...
22
23
24
  </template>
  <script>
      export default {
2cb8a6d9   梁灏   commit Table comp...
25
26
          data () {
              return {
f9f1865c   梁灏   Table columns add...
27
                  columns1: [
3d6fa54b   梁灏   update Table
28
29
30
                      {
                          title: '姓名',
                          key: 'name',
f9f1865c   梁灏   Table columns add...
31
32
                          fixed: 'right',
                          className: 'table-name-col'
3d6fa54b   梁灏   update Table
33
34
35
36
                      },
                      {
                          title: '年龄',
                          key: 'age',
3d6fa54b   梁灏   update Table
37
                          fixed: 'right',
f9f1865c   梁灏   Table columns add...
38
                          className: 'table-age-col'
3d6fa54b   梁灏   update Table
39
40
41
                      },
                      {
                          title: '地址',
f9f1865c   梁灏   Table columns add...
42
43
                          key: 'address',
                          className: 'table-address-col'
3d6fa54b   梁灏   update Table
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
                      }
                  ],
                  data1: [
                      {
                          name: '王小明',
                          age: 18,
                          address: '北京市朝阳区芍药居'
                      },
                      {
                          name: '张小刚',
                          age: 25,
                          address: '北京市海淀区西二旗'
                      },
                      {
                          name: '李小红',
                          age: 30,
                          address: '上海市浦东新区世纪大道'
                      },
                      {
                          name: '周小伟',
                          age: 26,
                          address: '深圳市南山区深南大道'
                      }
f9f1865c   梁灏   Table columns add...
67
                  ]
50637863   梁灏   update DatePicker
68
69
70
              }
          },
          methods: {
f9f1865c   梁灏   Table columns add...
71
72
73
74
75
76
77
              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...
78
              }
2cb8a6d9   梁灏   commit Table comp...
79
80
          }
      }
d0e206c5   梁灏   Table add content...
81
  </script>