Cascader add transfer prop

This commit is contained in:
梁灏 2017-07-20 16:00:03 +08:00
parent ecaf8d51e0
commit a9cd43b39c
5 changed files with 99 additions and 13 deletions

View file

@ -1,5 +1,14 @@
<template>
<Cascader v-model="value3" :data="data" filterable></Cascader>
<div style="width: 400px;">
<Row>
<i-col span="12">
<Cascader transfer v-model="value3" :data="data" filterable></Cascader>
</i-col>
<i-col span="12">
<Cascader v-model="value3" :data="data" filterable></Cascader>
</i-col>
</Row>
</div>
</template>
<script>
export default {

View file

@ -5,10 +5,11 @@
<Modal v-model="showModal" title="弹窗">
<Tabs>
<Tab-pane label="演示" style="height: 80px;">
<Date-picker transfer type="daterange" placement="bottom-end" placeholder="选择日期" style="width: 200px"></Date-picker>
<i-select transfer multiple v-model="m1">
<i-option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</i-option>
</i-select>
<!--<Date-picker transfer type="daterange" placement="bottom-end" placeholder="选择日期" style="width: 200px"></Date-picker>-->
<!--<i-select transfer multiple v-model="m1">-->
<!--<i-option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</i-option>-->
<!--</i-select>-->
<Cascader transfer :data="data4" :load-data="loadData"></Cascader>
</Tab-pane>
</Tabs>
</Modal>
@ -51,6 +52,20 @@
value: 'chongqing',
label: '重庆市'
}
],
data4: [
{
value: 'beijing',
label: '北京',
children: [],
loading: false
},
{
value: 'hangzhou',
label: '杭州',
children: [],
loading:false
}
]
}
},
@ -74,6 +89,40 @@
this.$refs["formSelect"].clearSingleSelect();
this.options = [];
// }, 300)
},
loadData (item, callback) {
item.loading = true;
setTimeout(() => {
if (item.value === 'beijing') {
item.children = [
{
value: 'talkingdata',
label: 'TalkingData'
},
{
value: 'baidu',
label: '百度'
},
{
value: 'sina',
label: '新浪'
}
];
} else if (item.value === 'hangzhou') {
item.children = [
{
value: 'ali',
label: '阿里巴巴'
},
{
value: '163',
label: '网易'
}
];
}
item.loading = false;
callback();
}, 1000);
}
}
}

View file

@ -3,7 +3,7 @@
<Poptip trigger="hover" title="提示标题" content="提示内容">
<Button>hover 激活</Button>
</Poptip>
<Poptip title="提示标题" content="提示内容">
<Poptip transfer title="提示标题" content="提示内容">
<Button>click 激活</Button>
</Poptip>
<Poptip trigger="focus" title="提示标题" content="提示内容">