element/packages/select/src/select-dropdown.vue

75 lines
1.4 KiB
Vue
Raw Normal View History

2016-07-27 06:15:02 +00:00
<template>
<div
class="el-select-dropdown el-popper"
:class="[{ 'is-multiple': $parent.multiple }, popperClass]"
:style="{ minWidth: minWidth }">
2016-07-27 06:15:02 +00:00
<slot></slot>
</div>
</template>
<script type="text/babel">
2016-10-13 03:12:24 +00:00
import Popper from 'element-ui/src/utils/vue-popper';
2016-07-27 06:15:02 +00:00
export default {
name: 'ElSelectDropdown',
2016-07-27 06:15:02 +00:00
2016-11-26 07:18:38 +00:00
componentName: 'ElSelectDropdown',
2016-07-27 06:15:02 +00:00
mixins: [Popper],
2016-07-27 06:15:02 +00:00
props: {
placement: {
default: 'bottom-start'
2016-07-27 06:15:02 +00:00
},
boundariesPadding: {
default: 0
2016-07-27 06:15:02 +00:00
},
popperOptions: {
default() {
return {
gpuAcceleration: false
};
}
},
visibleArrow: {
default: true
},
appendToBody: {
type: Boolean,
default: true
2016-07-27 06:15:02 +00:00
}
},
data() {
return {
minWidth: ''
};
},
computed: {
popperClass() {
return this.$parent.popperClass;
}
},
watch: {
'$parent.inputWidth'() {
this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
2016-07-27 06:15:02 +00:00
}
},
mounted() {
this.referenceElm = this.$parent.$refs.reference.$el;
this.$parent.popperElm = this.popperElm = this.$el;
this.$on('updatePopper', () => {
if (this.$parent.visible) this.updatePopper();
});
2016-10-12 13:12:54 +00:00
this.$on('destroyPopper', this.destroyPopper);
2016-07-27 06:15:02 +00:00
}
};
</script>