Commit 122e69ee97cb8c68fc6933652a784860c2b5dd30
1 parent
37ee1535
update Transfer
update Transfer
Showing
6 changed files
with
44 additions
and
13 deletions
Show diff stats
src/components/checkbox/checkbox.vue
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | v-model="checked" | 18 | v-model="checked" |
| 19 | @change="change"> | 19 | @change="change"> |
| 20 | </span> | 20 | </span> |
| 21 | - <slot v-if="showSlot"><span v-el:slot>{{ value }}</span></slot> | 21 | + <slot v-if="showSlot"><span v-el:slot style="display:none">{{ value }}</span></slot> |
| 22 | </label> | 22 | </label> |
| 23 | </template> | 23 | </template> |
| 24 | <script> | 24 | <script> |
| @@ -78,6 +78,8 @@ | @@ -78,6 +78,8 @@ | ||
| 78 | this.updateModel(); | 78 | this.updateModel(); |
| 79 | if (this.$els.slot && this.$els.slot.innerHTML === '') { | 79 | if (this.$els.slot && this.$els.slot.innerHTML === '') { |
| 80 | this.showSlot = false; | 80 | this.showSlot = false; |
| 81 | + } else { | ||
| 82 | + this.$els.slot.style.display = 'inline'; | ||
| 81 | } | 83 | } |
| 82 | } | 84 | } |
| 83 | }, | 85 | }, |
src/components/transfer/list.vue
| 1 | <template> | 1 | <template> |
| 2 | <div :class="prefixCls" :style="style"> | 2 | <div :class="prefixCls" :style="style"> |
| 3 | <div :class="prefixCls + '-header'"> | 3 | <div :class="prefixCls + '-header'"> |
| 4 | - <Checkbox :checked.sync="checkedAll" :disabled="checkedAllDisabled" @on-change="toggleSelectAll">{{ title }}</Checkbox> | 4 | + <Checkbox :checked.sync="checkedAll" :disabled="checkedAllDisabled" @on-change="toggleSelectAll"></Checkbox> |
| 5 | + <span>{{ title }}</span> | ||
| 5 | <span :class="prefixCls + '-header-count'">{{ count }}</span> | 6 | <span :class="prefixCls + '-header-count'">{{ count }}</span> |
| 6 | </div> | 7 | </div> |
| 7 | <div :class="bodyClasses"> | 8 | <div :class="bodyClasses"> |
| @@ -15,7 +16,10 @@ | @@ -15,7 +16,10 @@ | ||
| 15 | <li | 16 | <li |
| 16 | v-for="item in showItems | filterBy filterData" | 17 | v-for="item in showItems | filterBy filterData" |
| 17 | :class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]" | 18 | :class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]" |
| 18 | - @click.prevent="select(item)"><Checkbox :checked="isCheck(item)" :disabled="item.disabled">{{ showLabel(item) }}</Checkbox></li> | 19 | + @click.prevent="select(item)"> |
| 20 | + <Checkbox :checked="isCheck(item)" :disabled="item.disabled"></Checkbox> | ||
| 21 | + <span>{{ showLabel(item) }}</span> | ||
| 22 | + </li> | ||
| 19 | <li :class="prefixCls + '-content-not-found'">{{ notFoundText }}</li> | 23 | <li :class="prefixCls + '-content-not-found'">{{ notFoundText }}</li> |
| 20 | </ul> | 24 | </ul> |
| 21 | </div> | 25 | </div> |
| @@ -82,9 +86,7 @@ | @@ -82,9 +86,7 @@ | ||
| 82 | index > -1 ? this.checkedKeys.splice(index, 1) : this.checkedKeys.push(item.key); | 86 | index > -1 ? this.checkedKeys.splice(index, 1) : this.checkedKeys.push(item.key); |
| 83 | }, | 87 | }, |
| 84 | updateFilteredData () { | 88 | updateFilteredData () { |
| 85 | - this.showItems = this.data.map(item => { | ||
| 86 | - return item; | ||
| 87 | - }) | 89 | + this.showItems = this.data; |
| 88 | }, | 90 | }, |
| 89 | toggleSelectAll (status) { | 91 | toggleSelectAll (status) { |
| 90 | this.checkedKeys = status ? | 92 | this.checkedKeys = status ? |
src/styles/components/transfer.less
| @@ -12,14 +12,14 @@ | @@ -12,14 +12,14 @@ | ||
| 12 | font-size: @font-size-small; | 12 | font-size: @font-size-small; |
| 13 | vertical-align: middle; | 13 | vertical-align: middle; |
| 14 | border: 1px solid @border-color-base; | 14 | border: 1px solid @border-color-base; |
| 15 | - border-radius: @border-radius-base; | 15 | + border-radius: @border-radius-base @border-radius-base 0 0; |
| 16 | position: relative; | 16 | position: relative; |
| 17 | padding-top: 35px; | 17 | padding-top: 35px; |
| 18 | 18 | ||
| 19 | &-header { | 19 | &-header { |
| 20 | padding: 8px 16px; | 20 | padding: 8px 16px; |
| 21 | border-radius: @border-radius-base @border-radius-base 0 0; | 21 | border-radius: @border-radius-base @border-radius-base 0 0; |
| 22 | - background: #fff; | 22 | + background: @head-bg; |
| 23 | color: @text-color; | 23 | color: @text-color; |
| 24 | border-bottom: 1px solid @border-color-split; | 24 | border-bottom: 1px solid @border-color-split; |
| 25 | overflow: hidden; | 25 | overflow: hidden; |
| @@ -28,6 +28,10 @@ | @@ -28,6 +28,10 @@ | ||
| 28 | left: 0; | 28 | left: 0; |
| 29 | width: 100%; | 29 | width: 100%; |
| 30 | 30 | ||
| 31 | + & > span{ | ||
| 32 | + padding-left: 4px; | ||
| 33 | + } | ||
| 34 | + | ||
| 31 | &-count { | 35 | &-count { |
| 32 | margin: 0 !important; | 36 | margin: 0 !important; |
| 33 | float: right; | 37 | float: right; |
| @@ -39,7 +43,7 @@ | @@ -39,7 +43,7 @@ | ||
| 39 | position: relative; | 43 | position: relative; |
| 40 | 44 | ||
| 41 | &-with-search{ | 45 | &-with-search{ |
| 42 | - padding-top: 40px; | 46 | + padding-top: 34px; |
| 43 | } | 47 | } |
| 44 | } | 48 | } |
| 45 | 49 | ||
| @@ -52,6 +56,10 @@ | @@ -52,6 +56,10 @@ | ||
| 52 | overflow: hidden; | 56 | overflow: hidden; |
| 53 | white-space: nowrap; | 57 | white-space: nowrap; |
| 54 | text-overflow: ellipsis; | 58 | text-overflow: ellipsis; |
| 59 | + | ||
| 60 | + & > span{ | ||
| 61 | + padding-left: 4px; | ||
| 62 | + } | ||
| 55 | } | 63 | } |
| 56 | 64 | ||
| 57 | &-not-found{ | 65 | &-not-found{ |
| @@ -64,11 +72,11 @@ | @@ -64,11 +72,11 @@ | ||
| 64 | } | 72 | } |
| 65 | } | 73 | } |
| 66 | &-body-with-search &-content{ | 74 | &-body-with-search &-content{ |
| 67 | - padding: 0; | 75 | + padding: 6px 0 0; |
| 68 | } | 76 | } |
| 69 | 77 | ||
| 70 | &-body-search-wrapper{ | 78 | &-body-search-wrapper{ |
| 71 | - padding: 8px; | 79 | + padding: 8px 8px 0; |
| 72 | position: absolute; | 80 | position: absolute; |
| 73 | top: 0; | 81 | top: 0; |
| 74 | left: 0; | 82 | left: 0; |
| @@ -78,6 +86,15 @@ | @@ -78,6 +86,15 @@ | ||
| 78 | &-search{ | 86 | &-search{ |
| 79 | position: relative; | 87 | position: relative; |
| 80 | } | 88 | } |
| 89 | + | ||
| 90 | + &-footer{ | ||
| 91 | + margin: 0 -1px; | ||
| 92 | + border: 1px solid @border-color-base; | ||
| 93 | + border-top: none; | ||
| 94 | + border-radius: 0 0 @border-radius-base @border-radius-base; | ||
| 95 | + | ||
| 96 | + .clearfix(); | ||
| 97 | + } | ||
| 81 | } | 98 | } |
| 82 | &-operation { | 99 | &-operation { |
| 83 | display: inline-block; | 100 | display: inline-block; |
src/styles/themes/default/custom.less
| @@ -37,6 +37,7 @@ | @@ -37,6 +37,7 @@ | ||
| 37 | @background-color-base : #f7f7f7; // base | 37 | @background-color-base : #f7f7f7; // base |
| 38 | @background-color-select-hover: @input-disabled-bg; | 38 | @background-color-select-hover: @input-disabled-bg; |
| 39 | @tooltip-bg : rgba(70, 76, 91, .9); | 39 | @tooltip-bg : rgba(70, 76, 91, .9); |
| 40 | +@head-bg : #f9fafc; | ||
| 40 | 41 | ||
| 41 | // Shadow | 42 | // Shadow |
| 42 | @shadow-color : rgba(0, 0, 0, .2); | 43 | @shadow-color : rgba(0, 0, 0, .2); |
test/routers/radio.vue
test/routers/transfer.vue
| @@ -10,11 +10,16 @@ | @@ -10,11 +10,16 @@ | ||
| 10 | filterable | 10 | filterable |
| 11 | :target-keys.sync="targetKeys" | 11 | :target-keys.sync="targetKeys" |
| 12 | :operations="['向左移动','向右移动']" | 12 | :operations="['向左移动','向右移动']" |
| 13 | - @on-change="change"></Transfer> | 13 | + :filter-method="filterMethod" |
| 14 | + @on-change="change"> | ||
| 15 | + <div :style="{float: 'right', margin: '5px'}"> | ||
| 16 | + <i-button type="ghost" size="small" @click="getMock">刷新</i-button> | ||
| 17 | + </div> | ||
| 18 | + </Transfer> | ||
| 14 | </div> | 19 | </div> |
| 15 | </template> | 20 | </template> |
| 16 | <script> | 21 | <script> |
| 17 | - import { Transfer } from 'iview'; | 22 | + import { Transfer, iButton } from 'iview'; |
| 18 | 23 | ||
| 19 | export default { | 24 | export default { |
| 20 | props: { | 25 | props: { |
| @@ -38,6 +43,9 @@ | @@ -38,6 +43,9 @@ | ||
| 38 | filterMethod (data, query) { | 43 | filterMethod (data, query) { |
| 39 | if (query === '') return true; | 44 | if (query === '') return true; |
| 40 | return data.label === query; | 45 | return data.label === query; |
| 46 | + }, | ||
| 47 | + getMock () { | ||
| 48 | + | ||
| 41 | } | 49 | } |
| 42 | } | 50 | } |
| 43 | } | 51 | } |