Commit 2404849c30fd0eacb0d40352335d66a274f42379
1 parent
1594942f
合并原作者更新
Showing
5 changed files
with
29 additions
and
14 deletions
Show diff stats
package.json
src/components/table/table.vue
| ... | ... | @@ -548,12 +548,16 @@ |
| 548 | 548 | this.data.forEach((row, index) => { |
| 549 | 549 | const newRow = deepCopy(row);// todo 直接替换 |
| 550 | 550 | newRow._isHover = false; |
| 551 | - if(newRow.checked){// 传checked:true 可以设置该行为默认选中状态 | |
| 552 | - newRow._isChecked = newRow.checked; | |
| 553 | - }else{ | |
| 551 | + if (newRow._checked) { | |
| 552 | + newRow._isChecked = newRow._checked; | |
| 553 | + } else { | |
| 554 | 554 | newRow._isChecked = false; |
| 555 | 555 | } |
| 556 | - newRow._isHighlight = false; | |
| 556 | + if (newRow._highlight) { | |
| 557 | + newRow._isHighlight = newRow._highlight; | |
| 558 | + } else { | |
| 559 | + newRow._isHighlight = false; | |
| 560 | + } | |
| 557 | 561 | data[index] = newRow; |
| 558 | 562 | }); |
| 559 | 563 | return data; | ... | ... |
src/components/transfer/list.vue
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | :class="itemClasses(item)" |
| 19 | 19 | @click.prevent="select(item)"> |
| 20 | 20 | <Checkbox :checked="isCheck(item)" :disabled="item.disabled"></Checkbox> |
| 21 | - <span>{{ showLabel(item) }}</span> | |
| 21 | + <span>{{{ showLabel(item) }}}</span> | |
| 22 | 22 | </li> |
| 23 | 23 | <li :class="prefixCls + '-content-not-found'">{{ notFoundText }}</li> |
| 24 | 24 | </ul> | ... | ... |
test/routers/table.vue
| 1 | 1 | <template> |
| 2 | - <i-table border :content="self" :columns="columns7" :data="data6"></i-table> | |
| 3 | - | |
| 4 | - 默认选中行 | |
| 5 | - <i-table border :content="self" :columns="columns8" :data="data8"></i-table> | |
| 2 | + <i-table highlight-row border :content="self" :columns="columns7" :data="data6"></i-table> | |
| 6 | 3 | </template> |
| 7 | 4 | <script> |
| 8 | 5 | export default { |
| ... | ... | @@ -11,6 +8,11 @@ |
| 11 | 8 | self: this, |
| 12 | 9 | columns7: [ |
| 13 | 10 | { |
| 11 | + type: 'selection', | |
| 12 | + width: 60, | |
| 13 | + align: 'center' | |
| 14 | + }, | |
| 15 | + { | |
| 14 | 16 | title: '姓名', |
| 15 | 17 | key: 'name', |
| 16 | 18 | render (row, column, index) { |
| ... | ... | @@ -50,22 +52,27 @@ |
| 50 | 52 | { |
| 51 | 53 | name: '王小明', |
| 52 | 54 | age: 18, |
| 53 | - address: '北京市朝阳区芍药居' | |
| 55 | + address: '北京市朝阳区芍药居', | |
| 56 | + _highlight: true, | |
| 57 | + _checked: true | |
| 54 | 58 | }, |
| 55 | 59 | { |
| 56 | 60 | name: '张小刚', |
| 57 | 61 | age: 25, |
| 58 | - address: '北京市海淀区西二旗' | |
| 62 | + address: '北京市海淀区西二旗', | |
| 63 | + _checked: true | |
| 59 | 64 | }, |
| 60 | 65 | { |
| 61 | 66 | name: '李小红', |
| 62 | 67 | age: 30, |
| 63 | - address: '上海市浦东新区世纪大道' | |
| 68 | + address: '上海市浦东新区世纪大道', | |
| 69 | + _checked: true | |
| 64 | 70 | }, |
| 65 | 71 | { |
| 66 | 72 | name: '周小伟', |
| 67 | 73 | age: 26, |
| 68 | - address: '深圳市南山区深南大道' | |
| 74 | + address: '深圳市南山区深南大道', | |
| 75 | + _checked: true | |
| 69 | 76 | } |
| 70 | 77 | ], |
| 71 | 78 | columns8:[ | ... | ... |
test/routers/transfer.vue
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | :data="data2" |
| 4 | 4 | :target-keys="targetKeys2" |
| 5 | 5 | filterable |
| 6 | + :render-format="rf" | |
| 6 | 7 | :filter-method="filterMethod" |
| 7 | 8 | @on-change="handleChange2"></Transfer> |
| 8 | 9 | </template> |
| ... | ... | @@ -37,6 +38,9 @@ |
| 37 | 38 | }, |
| 38 | 39 | filterMethod (data, query) { |
| 39 | 40 | return data.label.indexOf(query) > -1; |
| 41 | + }, | |
| 42 | + rf (data) { | |
| 43 | + return '<i class="ivu-icon ivu-icon-alert"></i>' + data.label; | |
| 40 | 44 | } |
| 41 | 45 | } |
| 42 | 46 | } | ... | ... |