Select add transfer prop
This commit is contained in:
梁灏 2017-07-20 10:37:12 +08:00
parent 835b37ff9f
commit 595cfa72fe
4 changed files with 55 additions and 17 deletions

View file

@ -1,12 +1,20 @@
<template> <template>
<div> <div>
<i-button @click="modal=true">show modal</i-button> <i-button @click="showModal = true">Modal有Tabs</i-button>
<Modal v-model="modal" @on-ok="resetForm" @on-cancel="resetForm" title="表单"> <i-button @click="showModal2 = true">Modal无Tabs</i-button>
<div> <Modal v-model="showModal" title="弹窗">
<i-select ref="formSelect" filterable remote clearable :remote-method="remoteMethod" :loading="loading"> <Tabs>
<i-option v-for="option in options" :value="option.value" :key="option.value">{{option.label}}</i-option> <Tab-pane label="演示" style="height: 80px;">
</i-select> <i-select transfer>
</div> <i-option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</i-option>
</i-select>
</Tab-pane>
</Tabs>
</Modal>
<Modal v-model="showModal2" title="弹窗">
<i-select>
<i-option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</i-option>
</i-select>
</Modal> </Modal>
</div> </div>
</template> </template>
@ -14,17 +22,32 @@
export default { export default {
data () { data () {
return { return {
modal: false, showModal: false,
loading: false, showModal2: false,
options: [], options: [
cityList: [
{ {
value: "beijing", value: 'beijing',
label: "北京市" label: '北京市'
}, },
{ {
value: "shanghai", value: 'shanghai',
label: "上海市" label: '上海市'
},
{
value: 'shenzhen',
label: '深圳市'
},
{
value: 'hangzhou',
label: '杭州市'
},
{
value: 'nanjing',
label: '南京市'
},
{
value: 'chongqing',
label: '重庆市'
} }
] ]
} }

View file

@ -25,7 +25,13 @@
<Icon type="arrow-down-b" :class="[prefixCls + '-arrow']" v-if="!remote"></Icon> <Icon type="arrow-down-b" :class="[prefixCls + '-arrow']" v-if="!remote"></Icon>
</div> </div>
<transition :name="transitionName"> <transition :name="transitionName">
<Drop v-show="dropVisible" :placement="placement" ref="dropdown"> <Drop
:class="{ [prefixCls + '-dropdown-transfer']: transfer }"
v-show="dropVisible"
:placement="placement"
ref="dropdown"
:data-transfer="transfer"
v-transfer-dom>
<ul v-show="notFountShow" :class="[prefixCls + '-not-found']"><li>{{ localeNotFoundText }}</li></ul> <ul v-show="notFountShow" :class="[prefixCls + '-not-found']"><li>{{ localeNotFoundText }}</li></ul>
<ul v-show="(!notFound && !remote) || (remote && !loading && !notFound)" :class="[prefixCls + '-dropdown-list']"><slot></slot></ul> <ul v-show="(!notFound && !remote) || (remote && !loading && !notFound)" :class="[prefixCls + '-dropdown-list']"><slot></slot></ul>
<ul v-show="loading" :class="[prefixCls + '-loading']">{{ localeLoadingText }}</ul> <ul v-show="loading" :class="[prefixCls + '-loading']">{{ localeLoadingText }}</ul>
@ -37,6 +43,7 @@
import Icon from '../icon'; import Icon from '../icon';
import Drop from './dropdown.vue'; import Drop from './dropdown.vue';
import clickoutside from '../../directives/clickoutside'; import clickoutside from '../../directives/clickoutside';
import TransferDom from '../../directives/transfer-dom';
import { oneOf, findComponentDownward } from '../../utils/assist'; import { oneOf, findComponentDownward } from '../../utils/assist';
import Emitter from '../../mixins/emitter'; import Emitter from '../../mixins/emitter';
import Locale from '../../mixins/locale'; import Locale from '../../mixins/locale';
@ -47,7 +54,7 @@
name: 'iSelect', name: 'iSelect',
mixins: [ Emitter, Locale ], mixins: [ Emitter, Locale ],
components: { Icon, Drop }, components: { Icon, Drop },
directives: { clickoutside }, directives: { clickoutside, TransferDom },
props: { props: {
value: { value: {
type: [String, Number, Array], type: [String, Number, Array],
@ -111,6 +118,10 @@
return oneOf(value, ['top', 'bottom']); return oneOf(value, ['top', 'bottom']);
}, },
default: 'bottom' default: 'bottom'
},
transfer: {
type: Boolean,
default: false
} }
}, },
data () { data () {

View file

@ -14,6 +14,9 @@
box-shadow: @shadow-base; box-shadow: @shadow-base;
position: absolute; position: absolute;
z-index: @zindex-select; z-index: @zindex-select;
&-transfer{
z-index: @zindex-transfer;
}
} }
.@{modal-prefix-cls} { .@{modal-prefix-cls} {
.@{select-dropdown-prefix-cls} { .@{select-dropdown-prefix-cls} {

View file

@ -147,6 +147,7 @@
@zindex-message : 1010; @zindex-message : 1010;
@zindex-notification : 1010; @zindex-notification : 1010;
@zindex-tooltip : 1060; @zindex-tooltip : 1060;
@zindex-transfer : 1060;
@zindex-loading-bar : 2000; @zindex-loading-bar : 2000;
// Animation // Animation