Commit 9084eb187268a231591832fbe888c1a5c3460e1a
1 parent
06aa0395
fixed #92
fixed #92
Showing
2 changed files
with
28 additions
and
37 deletions
Show diff stats
src/components/modal/modal.vue
| @@ -193,8 +193,8 @@ | @@ -193,8 +193,8 @@ | ||
| 193 | this.buttonLoading = false; | 193 | this.buttonLoading = false; |
| 194 | setTimeout(() => { | 194 | setTimeout(() => { |
| 195 | this.wrapShow = false; | 195 | this.wrapShow = false; |
| 196 | + this.removeScrollEffect(); | ||
| 196 | }, 300); | 197 | }, 300); |
| 197 | - this.removeScrollEffect(); | ||
| 198 | } else { | 198 | } else { |
| 199 | this.wrapShow = true; | 199 | this.wrapShow = true; |
| 200 | this.addScrollEffect(); | 200 | this.addScrollEffect(); |
test/routers/transfer.vue
| 1 | -<style> | ||
| 2 | - body{ | ||
| 3 | - height: auto; | ||
| 4 | - } | ||
| 5 | -</style> | ||
| 6 | <template> | 1 | <template> |
| 7 | - <div class="ivu-article" style="margin: 50px;"> | ||
| 8 | - <Transfer | ||
| 9 | - :data="data" | 2 | + <Transfer |
| 3 | + :data="data2" | ||
| 4 | + :target-keys="targetKeys2" | ||
| 10 | filterable | 5 | filterable |
| 11 | - :target-keys.sync="targetKeys" | ||
| 12 | - :operations="['向左移动','向右移动']" | ||
| 13 | :filter-method="filterMethod" | 6 | :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> | ||
| 19 | - </div> | 7 | + @on-change="handleChange2"></Transfer> |
| 20 | </template> | 8 | </template> |
| 21 | <script> | 9 | <script> |
| 22 | - import { Transfer, iButton } from 'iview'; | ||
| 23 | - | ||
| 24 | export default { | 10 | export default { |
| 25 | - props: { | ||
| 26 | - | ||
| 27 | - }, | ||
| 28 | data () { | 11 | data () { |
| 29 | return { | 12 | return { |
| 30 | - data: [{"key":"0","label":"content1","description":"description of content1","disabled":true},{"key":"1","label":"content2","description":"description of content2","disabled": false},{"key":"2","label":"content3","description":"description of content3","disabled":false},{"key":"3","label":"content4","description":"description of content4","disabled":false},{"key":"4","label":"content5","description":"description of content5","disabled":true},{"key":"5","label":"content6","description":"description of content6","disabled":false},{"key":"6","label":"content7","description":"description of content7","disabled":false},{"key":"7","label":"content8","description":"description of content8","disabled":false},{"key":"8","label":"content9","description":"description of content9","disabled":true},{"key":"9","label":"content10","description":"description of content10","disabled":false},{"key":"10","label":"content11","description":"description of content11","disabled":false},{"key":"11","label":"content12","description":"description of content12","disabled":false},{"key":"12","label":"content13","description":"description of content13","disabled":true},{"key":"13","label":"content14","description":"description of content14","disabled":false},{"key":"14","label":"content15","description":"description of content15","disabled":false},{"key":"15","label":"content16","description":"description of content16","disabled":false},{"key":"16","label":"content17","description":"description of content17","disabled":false},{"key":"17","label":"content18","description":"description of content18","disabled":true},{"key":"18","label":"content19","description":"description of content19","disabled":false},{"key":"19","label":"content20","description":"description of content20","disabled":false}], | ||
| 31 | - targetKeys: ['1','2','3','5','8'], | ||
| 32 | - selectedKeys: ['0','1','4', '5','6','9'] | 13 | + data2: this.getMockData(), |
| 14 | + targetKeys2: this.getTargetKeys() | ||
| 33 | } | 15 | } |
| 34 | }, | 16 | }, |
| 35 | - computed: { | ||
| 36 | - | ||
| 37 | - }, | ||
| 38 | methods: { | 17 | methods: { |
| 39 | - change (newTargetKeys, direction, moveKeys) { | ||
| 40 | -// console.log(newTargetKeys) | ||
| 41 | - this.targetKeys = newTargetKeys; | 18 | + getMockData () { |
| 19 | + let mockData = []; | ||
| 20 | + for (let i = 1; i <= 20; i++) { | ||
| 21 | + mockData.push({ | ||
| 22 | + key: i.toString(), | ||
| 23 | + label: '内容' + i, | ||
| 24 | + description: '内容' + i + '的描述信息', | ||
| 25 | + disabled: Math.random() * 3 < 1 | ||
| 26 | + }); | ||
| 27 | + } | ||
| 28 | + return mockData; | ||
| 42 | }, | 29 | }, |
| 43 | - filterMethod (data, query) { | ||
| 44 | - if (query === '') return true; | ||
| 45 | - return data.label === query; | 30 | + getTargetKeys () { |
| 31 | + return this.getMockData() | ||
| 32 | + .filter(() => Math.random() * 2 > 1) | ||
| 33 | + .map(item => item.key); | ||
| 34 | + }, | ||
| 35 | + handleChange2 (newTargetKeys) { | ||
| 36 | + this.targetKeys2 = newTargetKeys; | ||
| 46 | }, | 37 | }, |
| 47 | - getMock () { | ||
| 48 | - | 38 | + filterMethod (data, query) { |
| 39 | + return data.label.indexOf(query) > -1; | ||
| 49 | } | 40 | } |
| 50 | } | 41 | } |
| 51 | } | 42 | } |
| 52 | -</script> | ||
| 53 | \ No newline at end of file | 43 | \ No newline at end of file |
| 44 | +</script> |