This commit is contained in:
梁灏 2018-09-10 16:10:35 +08:00
parent 16c2b8d26e
commit 7bafe9d94c
15 changed files with 230 additions and 27 deletions

View file

@ -7,6 +7,8 @@
import { getStyle } from '../../utils/assist';
const Popper = isServer ? function() {} : require('popper.js/dist/umd/popper.js'); // eslint-disable-line
import { transferIndex, transferIncrease } from '../../utils/transfer-queue';
export default {
name: 'Drop',
props: {
@ -16,19 +18,26 @@
},
className: {
type: String
},
transfer: {
type: Boolean
}
},
data () {
return {
popper: null,
width: '',
popperStatus: false
popperStatus: false,
tIndex: this.handleGetIndex()
};
},
computed: {
styles () {
let style = {};
if (this.width) style.minWidth = `${this.width}px`;
if (this.transfer) style['z-index'] = 1060 + this.tIndex;
return style;
}
},
@ -66,6 +75,7 @@
if (this.$parent.$options.name === 'iSelect') {
this.width = parseInt(getStyle(this.$parent.$el, 'width'));
}
this.tIndex = this.handleGetIndex();
},
destroy () {
if (this.popper) {
@ -89,7 +99,11 @@
if(!leftOrRight){
this.popper.popper.style.transformOrigin = placementStart==='bottom' || ( placementStart !== 'top' && placementEnd === 'start') ? 'center top' : 'center bottom';
}
}
},
handleGetIndex () {
transferIncrease();
return transferIndex;
},
},
created () {
this.$on('on-update-popper', this.update);

View file

@ -54,6 +54,7 @@
:placement="placement"
ref="dropdown"
:data-transfer="transfer"
:transfer="transfer"
v-transfer-dom
>
<ul v-show="showNotFoundLabel" :class="[prefixCls + '-not-found']"><li>{{ localeNotFoundText }}</li></ul>