commit
7778edfa02
2 changed files with 89 additions and 12 deletions
|
@ -50,13 +50,13 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Transfer
|
<Transfer
|
||||||
:data="data3"
|
:data="data3"
|
||||||
:target-keys="targetKeys3"
|
:target-keys="targetKeys3"
|
||||||
:list-style="listStyle"
|
:list-style="listStyle"
|
||||||
:render-format="render3"
|
:render-format="render3"
|
||||||
:operations="['向左移动','向右移动']"
|
:operations="['向左移动','向右移动']"
|
||||||
filterable
|
filterable
|
||||||
@on-change="handleChange3">
|
@on-change="handleChange3">
|
||||||
<div :style="{float: 'right', margin: '5px'}">
|
<div :style="{float: 'right', margin: '5px'}">
|
||||||
<Button type="ghost" size="small" @click.native="reloadMockData">刷新</Button>
|
<Button type="ghost" size="small" @click.native="reloadMockData">刷新</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<template>
|
<!-- <template>
|
||||||
<div :class="classes">
|
<div :class="classes">
|
||||||
<List
|
<List
|
||||||
ref="left"
|
ref="left"
|
||||||
|
@ -15,11 +15,14 @@
|
||||||
:filter-method="filterMethod"
|
:filter-method="filterMethod"
|
||||||
:not-found-text="notFoundText">
|
:not-found-text="notFoundText">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</List><Operation
|
</List>
|
||||||
|
<Operation
|
||||||
:prefix-cls="prefixCls"
|
:prefix-cls="prefixCls"
|
||||||
:operations="operations"
|
:operations="operations"
|
||||||
:left-active="leftValidKeysCount > 0"
|
:left-active="leftValidKeysCount > 0"
|
||||||
:right-active="rightValidKeysCount > 0"></Operation><List
|
:right-active="rightValidKeysCount > 0">
|
||||||
|
</Operation>
|
||||||
|
<List
|
||||||
ref="right"
|
ref="right"
|
||||||
:prefix-cls="prefixCls + '-list'"
|
:prefix-cls="prefixCls + '-list'"
|
||||||
:data="rightData"
|
:data="rightData"
|
||||||
|
@ -33,10 +36,10 @@
|
||||||
:filter-placeholder="filterPlaceholder"
|
:filter-placeholder="filterPlaceholder"
|
||||||
:filter-method="filterMethod"
|
:filter-method="filterMethod"
|
||||||
:not-found-text="notFoundText">
|
:not-found-text="notFoundText">
|
||||||
<slot name="right"></slot>
|
<slot></slot>
|
||||||
</List>
|
</List>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template> -->
|
||||||
<script>
|
<script>
|
||||||
import List from './list.vue';
|
import List from './list.vue';
|
||||||
import Operation from './operation.vue';
|
import Operation from './operation.vue';
|
||||||
|
@ -45,6 +48,80 @@
|
||||||
const prefixCls = 'ivu-transfer';
|
const prefixCls = 'ivu-transfer';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
render (createElement) {
|
||||||
|
|
||||||
|
function cloneVNode (vnode) {
|
||||||
|
const clonedChildren = vnode.children && vnode.children.map(vnode => cloneVNode(vnode));
|
||||||
|
const cloned = createElement(vnode.tag, vnode.data, clonedChildren);
|
||||||
|
cloned.text = vnode.text;
|
||||||
|
cloned.isComment = vnode.isComment;
|
||||||
|
cloned.componentOptions = vnode.componentOptions;
|
||||||
|
cloned.elm = vnode.elm;
|
||||||
|
cloned.context = vnode.context;
|
||||||
|
cloned.ns = vnode.ns;
|
||||||
|
cloned.isStatic = vnode.isStatic;
|
||||||
|
cloned.key = vnode.key;
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vNodes = this.$slots.default;
|
||||||
|
const clonedVNodes = vNodes.map(vnode => cloneVNode(vnode));
|
||||||
|
|
||||||
|
return createElement('div', {
|
||||||
|
'class': this.classes
|
||||||
|
}, [
|
||||||
|
createElement('List', {
|
||||||
|
ref: 'left',
|
||||||
|
props: {
|
||||||
|
prefixCls: this.prefixCls + '-list',
|
||||||
|
data: this.leftData,
|
||||||
|
renderFormat: this.renderFormat,
|
||||||
|
checkedKeys: this.leftCheckedKeys,
|
||||||
|
validKeysCount: this.leftValidKeysCount,
|
||||||
|
style: this.listStyle,
|
||||||
|
title: this.titles[0],
|
||||||
|
filterable: this.filterable,
|
||||||
|
filterPlaceholder: this.filterPlaceholder,
|
||||||
|
filterMethod: this.filterMethod,
|
||||||
|
notFoundText: this.notFoundText
|
||||||
|
},
|
||||||
|
on: {
|
||||||
|
'on-checked-keys-change': this.handleLeftCheckedKeysChange
|
||||||
|
}
|
||||||
|
}, vNodes),
|
||||||
|
|
||||||
|
createElement('Operation', {
|
||||||
|
props: {
|
||||||
|
prefixCls: this.prefixCls,
|
||||||
|
operations: this.operations,
|
||||||
|
leftActive: this.leftValidKeysCount > 0,
|
||||||
|
rightActive: this.rightValidKeysCount > 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
createElement('List', {
|
||||||
|
ref: 'right',
|
||||||
|
props: {
|
||||||
|
prefixCls: this.prefixCls + '-list',
|
||||||
|
data: this.rightData,
|
||||||
|
renderFormat: this.renderFormat,
|
||||||
|
checkedKeys: this.rightCheckedKeys,
|
||||||
|
validKeysCount: this.rightValidKeysCount,
|
||||||
|
style: this.listStyle,
|
||||||
|
title: this.titles[1],
|
||||||
|
filterable: this.filterable,
|
||||||
|
filterPlaceholder: this.filterPlaceholder,
|
||||||
|
filterMethod: this.filterMethod,
|
||||||
|
notFoundText: this.notFoundText
|
||||||
|
},
|
||||||
|
on: {
|
||||||
|
'on-checked-keys-change': this.handleRightCheckedKeysChange
|
||||||
|
}
|
||||||
|
}, clonedVNodes),
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
components: { List, Operation },
|
components: { List, Operation },
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue