Cascader add transfer prop
This commit is contained in:
parent
ecaf8d51e0
commit
a9cd43b39c
5 changed files with 99 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div :class="classes" v-clickoutside="handleClose">
|
||||
<div :class="[prefixCls + '-rel']" @click="toggleOpen">
|
||||
<div :class="[prefixCls + '-rel']" @click="toggleOpen" ref="reference">
|
||||
<slot>
|
||||
<i-input
|
||||
ref="input"
|
||||
|
@ -19,7 +19,12 @@
|
|||
</slot>
|
||||
</div>
|
||||
<transition name="slide-up">
|
||||
<Drop v-show="visible">
|
||||
<Drop
|
||||
v-show="visible"
|
||||
:class="{ [prefixCls + '-transfer']: transfer }"
|
||||
ref="drop"
|
||||
:data-transfer="transfer"
|
||||
v-transfer-dom>
|
||||
<div>
|
||||
<Caspanel
|
||||
v-show="!filterable || (filterable && query === '')"
|
||||
|
@ -51,6 +56,7 @@
|
|||
import Icon from '../icon/icon.vue';
|
||||
import Caspanel from './caspanel.vue';
|
||||
import clickoutside from '../../directives/clickoutside';
|
||||
import TransferDom from '../../directives/transfer-dom';
|
||||
import { oneOf } from '../../utils/assist';
|
||||
import Emitter from '../../mixins/emitter';
|
||||
import Locale from '../../mixins/locale';
|
||||
|
@ -62,7 +68,7 @@
|
|||
name: 'Cascader',
|
||||
mixins: [ Emitter, Locale ],
|
||||
components: { iInput, Drop, Icon, Caspanel },
|
||||
directives: { clickoutside },
|
||||
directives: { clickoutside, TransferDom },
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
|
@ -117,6 +123,10 @@
|
|||
},
|
||||
notFoundText: {
|
||||
type: String
|
||||
},
|
||||
transfer: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -333,11 +343,17 @@
|
|||
if (this.currentValue.length) {
|
||||
this.updateSelected();
|
||||
}
|
||||
if (this.transfer) {
|
||||
this.$refs.drop.update();
|
||||
}
|
||||
} else {
|
||||
if (this.filterable) {
|
||||
this.query = '';
|
||||
this.$refs.input.currentValue = '';
|
||||
}
|
||||
if (this.transfer) {
|
||||
this.$refs.drop.destroy();
|
||||
}
|
||||
}
|
||||
this.$emit('on-visible-change', val);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue