Blame view

src/components/table/table-body.vue 2.36 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
7f34c510   梁灏   update Table
2
3
4
5
6
7
      <table cellspacing="0" cellpadding="0" border="0" :style="style">
          <colgroup>
              <col v-for="column in columns" :width="setCellWidth(column, $index)">
          </colgroup>
          <tbody :class="[prefixCls + '-tbody']">
              <tr
52874e27   梁灏   update Table
8
                  v-for="(index, row) in cloneData"
c6f21c2f   jingsam   :bug: fix ie bug
9
                  :class="rowClasses(row, index)"
7f34c510   梁灏   update Table
10
11
12
13
14
15
16
17
18
19
20
21
22
23
                  @mouseenter.stop="handleMouseIn(index)"
                  @mouseleave.stop="handleMouseOut(index)"
                  @click.stop="highlightCurrentRow(index)">
                  <td v-for="column in columns" :class="alignCls(column)">
                      <Cell
                          :fixed="fixed"
                          :prefix-cls="prefixCls"
                          :row="row"
                          :column="column"
                          :index="index"
                          :checked="cloneData[index] && cloneData[index]._isChecked"></Cell>
                  </td>
              </tr>
          </tbody>
3ef4dfb9   梁灏   update Table
24
      </table>
2cb8a6d9   梁灏   commit Table comp...
25
26
  </template>
  <script>
7f34c510   梁灏   update Table
27
28
29
      import Cell from './cell.vue';
      import Mixin from './mixin';
  
2cb8a6d9   梁灏   commit Table comp...
30
      export default {
7f34c510   梁灏   update Table
31
32
          mixins: [ Mixin ],
          components: { Cell },
2cb8a6d9   梁灏   commit Table comp...
33
          props: {
7f34c510   梁灏   update Table
34
35
36
              prefixCls: String,
              style: Object,
              columns: Array,
7f34c510   梁灏   update Table
37
38
              cloneData: Array,
              fixed: Boolean
2cb8a6d9   梁灏   commit Table comp...
39
40
          },
          methods: {
c6f21c2f   jingsam   :bug: fix ie bug
41
42
43
44
45
46
47
48
              rowClasses (row, index) {
                  return [
                      `${this.prefixCls}-row`,
                      this.rowClsName(index),
                      {
                          [`${this.prefixCls}-row-highlight`]: this.cloneData[index] && this.cloneData[index]._isHighlight,
                          [`${this.prefixCls}-row-hover`]: this.cloneData[index] && this.cloneData[index]._isHover
                      }
c6f21c2f   jingsam   :bug: fix ie bug
49
50
                  ]
              },
7f34c510   梁灏   update Table
51
52
53
54
              setCellWidth (column, index) {
                  return this.$parent.setCellWidth(column, index);
              },
              rowClsName (index) {
52874e27   梁灏   update Table
55
                  return this.$parent.rowClassName(this.cloneData[index], index);
7f34c510   梁灏   update Table
56
57
58
59
60
61
62
63
64
65
              },
              handleMouseIn (index) {
                  this.$parent.handleMouseIn(index);
              },
              handleMouseOut (index) {
                  this.$parent.handleMouseOut(index);
              },
              highlightCurrentRow (index) {
                  this.$parent.highlightCurrentRow(index);
              }
2cb8a6d9   梁灏   commit Table comp...
66
67
          }
      }
c6f21c2f   jingsam   :bug: fix ie bug
68
  </script>