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

42 lines
865 B
Vue
Raw Normal View History

2016-07-27 06:15:02 +00:00
<template>
2016-12-03 10:59:04 +00:00
<transition name="el-zoom-in-top" @after-leave="doDestroy">
2016-11-04 05:59:03 +00:00
<ul class="el-dropdown-menu" v-show="showPopper">
2016-10-13 05:54:02 +00:00
<slot></slot>
</ul>
</transition>
2016-07-27 06:15:02 +00:00
</template>
<script>
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 {
2016-10-05 03:03:44 +00:00
name: 'ElDropdownMenu',
componentName: 'ElDropdownMenu',
2016-07-27 06:15:02 +00:00
mixins: [Popper],
created() {
this.$on('updatePopper', () => {
if (this.showPopper) this.updatePopper();
});
this.$on('visible', val => {
this.showPopper = val;
2016-07-27 06:15:02 +00:00
});
},
mounted() {
this.$parent.popperElm = this.popperElm = this.$el;
this.referenceElm = this.$parent.$el;
},
watch: {
2016-12-29 08:37:46 +00:00
'$parent.menuAlign': {
immediate: true,
handler(val) {
this.currentPlacement = `bottom-${val}`;
}
}
2016-07-27 06:15:02 +00:00
}
};
</script>