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

40 lines
726 B
Vue
Raw Normal View History

2016-07-27 06:15:02 +00:00
<template>
2016-10-05 03:03:44 +00:00
<ul class="el-dropdown__menu">
2016-07-27 06:15:02 +00:00
<slot></slot>
</ul>
</template>
<script>
2016-08-22 04:02:09 +00:00
import Popper from 'main/utils/popper';
2016-07-27 06:15:02 +00:00
export default {
2016-10-05 03:03:44 +00:00
name: 'ElDropdownMenu',
props: {
visible: Boolean
},
2016-07-27 06:15:02 +00:00
data() {
return {
popper: null
};
},
computed: {
menuAlign() {
return this.$parent.menuAlign;
}
},
2016-08-12 04:19:06 +00:00
mounted() {
2016-07-27 06:15:02 +00:00
document.body.appendChild(this.$el);
this.$nextTick(() => {
this.popper = new Popper(this.$parent.$el, this.$el, { gpuAcceleration: false, placement: `bottom-${this.menuAlign}` });
});
},
2016-08-12 04:19:06 +00:00
destroyed() {
2016-07-27 06:15:02 +00:00
setTimeout(() => {
this.popper.destroy();
}, 300);
}
};
</script>