Commit 17db7df4fd27fba03db50ef2afb17c31078bb3d7

Authored by 梁灏
1 parent 0e4166bd

fixed #1751

examples/routers/table.vue
1 1 <template>
2   - <Table :columns="columns10" :data="data9"></Table>
  2 + <Table border :columns="columns4" :data="data1"></Table>
3 3 </template>
4 4 <script>
5   - import expandRow from '../components/tableExpand.vue';
6 5 export default {
7   - components: { expandRow },
8 6 data () {
9 7 return {
10   - columns10: [
  8 + columns4: [
11 9 {
12   - type: 'expand',
13   - width: 100,
14   - title: '展',
15   - renderHeader (h) {
16   - return h('i', '展开')
17   - },
18   - render: (h, params) => {
19   - return h(expandRow, {
20   - props: {
21   - row: params.row
22   - }
23   - })
24   - }
  10 + type: 'selection',
  11 + width: 60,
  12 + align: 'center'
25 13 },
26 14 {
27 15 title: '姓名',
... ... @@ -36,53 +24,34 @@
36 24 key: 'address'
37 25 }
38 26 ],
39   - data9: [
  27 + data1: [
40 28 {
41 29 name: '王小明',
42 30 age: 18,
43 31 address: '北京市朝阳区芍药居',
44   - job: '数据工程师',
45   - interest: '羽毛球',
46   - birthday: '1991-05-14',
47   - book: '乔布斯传',
48   - movie: '致命魔术',
49   - music: 'I Cry'
  32 + _disabled: false,
  33 + _checked: true
50 34 },
51 35 {
52 36 name: '张小刚',
53 37 age: 25,
54 38 address: '北京市海淀区西二旗',
55   - job: '数据科学家',
56   - interest: '排球',
57   - birthday: '1989-03-18',
58   - book: '我的奋斗',
59   - movie: '罗马假日',
60   - music: 'My Heart Will Go On'
  39 + _disabled: true
61 40 },
62 41 {
63 42 name: '李小红',
64 43 age: 30,
65 44 address: '上海市浦东新区世纪大道',
66   - job: '数据产品经理',
67   - interest: '网球',
68   - birthday: '1992-01-31',
69   - book: '赢',
70   - movie: '乔布斯',
71   - music: 'Don’t Cry'
  45 + _disabled: true
72 46 },
73 47 {
74 48 name: '周小伟',
75 49 age: 26,
76 50 address: '深圳市南山区深南大道',
77   - job: '数据分析师',
78   - interest: '桌球,跑步',
79   - birthday: '1988-7-25',
80   - book: '红楼梦',
81   - movie: '倩女幽魂',
82   - music: '演员'
  51 + _disabled: true
83 52 }
84 53 ]
85 54 }
86 55 }
87 56 }
88   -</script>
89 57 \ No newline at end of file
  58 +</script>
... ...
src/components/table/table-head.vue
... ... @@ -92,6 +92,7 @@
92 92 isSelectAll () {
93 93 let isSelectAll = true;
94 94 if (!this.data.length) isSelectAll = false;
  95 + if (!this.data.find(item => !item._disabled)) isSelectAll = false; // #1751
95 96 for (let i = 0; i < this.data.length; i++) {
96 97 if (!this.objData[this.data[i]._index]._isChecked && !this.objData[this.data[i]._index]._isDisabled) {
97 98 isSelectAll = false;
... ...