87,993
社区成员
发帖
与我相关
我的任务
分享
<template>
<a-card>
<a-card-grid style="width:25%;">
<a-tabs :defaultActiveKey="defaultActiveKey"
:tabPosition="mode"
:activeKey="defaultActiveKey"
@change="chooseThisAssayHeader">
<a-tab-pane v-for="item in tabList" :tab="item.name"
:key="item.key">
</a-tab-pane>
</a-tabs>
</a-card-grid>
<a-card-grid style="width:75%;">
<a-transfer
:dataSource="mockData"
:titles="['当前项', '已选项']"
:listStyle="{
width: '45%',
height: '600px',
}"
:operations="['选中', '去除']"
:targetKeys="targetKeys"
@change="handleChange"
:render="item=>`${item.title}-${item.description}`"
>
<span slot="notFoundContent">
暂无相关数据
</span>
</a-transfer>
</a-card-grid>
</a-card>
</template>
<script>
export default {
data() {
return {
mode: 'left',
defaultActiveKey: 'A',
tabList: [
{name: 'Atab', id: '1', key: 'A'},
{name: 'Btab', id: '2', key: 'B'}
],
mockData: [
{title: 'A', description: 'A1', key: '1',},
{title: 'A', description: 'A2', key: '2'},
{ title: 'A',description: 'A3', key: '3'},
{title: 'B', description: 'B1', key: '4'},
{title: 'B', description: 'B2', key: '5'}
],
targetKeys: [],
}
},
methods: {
chooseThisAssayHeader(val) {
this.defaultActiveKey = val;
},
handleChange(targetKeys, direction, moveKeys) {
console.log(targetKeys, direction, moveKeys);
this.targetKeys = targetKeys
},
},
}
</script>
有办法么