mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-01 11:47:41 +08:00
Merge pull request #362 from QingWei-Li/fix/dropdown-menu
DropdownMenu: fix popper, fixed #342, #194
This commit is contained in:
commit
8b9a53fe62
@ -5,6 +5,10 @@
|
||||
*2016-XX-XX*
|
||||
|
||||
- Upload 新增 Data 属性支持额外数据的传输
|
||||
- DatePicker 修复 `$t` 报错
|
||||
- Popper 重构 vue-popper
|
||||
- Pagination 修复输入后再点击切换,输入框的值不更新
|
||||
- Step: 修复自定义 icon 的样式
|
||||
|
||||
### 1.0.0-rc.6
|
||||
|
||||
|
@ -1,39 +1,35 @@
|
||||
<template>
|
||||
<ul class="el-dropdown__menu">
|
||||
<transition name="md-fade-bottom" @after-leave="doDestroy">
|
||||
<ul class="el-dropdown__menu" v-show="showPopper">
|
||||
<slot></slot>
|
||||
</ul>
|
||||
</transition>
|
||||
</template>
|
||||
<script>
|
||||
import Popper from 'main/utils/popper';
|
||||
import Popper from 'main/utils/vue-popper';
|
||||
|
||||
export default {
|
||||
name: 'ElDropdownMenu',
|
||||
|
||||
props: {
|
||||
visible: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
popper: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
menuAlign() {
|
||||
return this.$parent.menuAlign;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
document.body.appendChild(this.$el);
|
||||
componentName: 'ElDropdownMenu',
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.popper = new Popper(this.$parent.$el, this.$el, { gpuAcceleration: false, placement: `bottom-${this.menuAlign}` });
|
||||
mixins: [Popper],
|
||||
|
||||
created() {
|
||||
this.$on('visible', val => {
|
||||
this.showPopper = val;
|
||||
});
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
setTimeout(() => {
|
||||
this.popper.destroy();
|
||||
}, 300);
|
||||
mounted() {
|
||||
this.popperElm = this.$el;
|
||||
this.referenceElm = this.$parent.$el;
|
||||
},
|
||||
|
||||
computed: {
|
||||
placement() {
|
||||
return `bottom-${this.$parent.menuAlign}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,9 +1,12 @@
|
||||
<script>
|
||||
import Clickoutside from 'main/utils/clickoutside';
|
||||
import emitter from 'main/mixins/emitter';
|
||||
|
||||
export default {
|
||||
name: 'ElDropdown',
|
||||
|
||||
mixins: [emitter],
|
||||
|
||||
directives: { Clickoutside },
|
||||
|
||||
props: {
|
||||
@ -32,6 +35,12 @@
|
||||
this.initEvent();
|
||||
},
|
||||
|
||||
watch: {
|
||||
visible(val) {
|
||||
this.broadcast('ElDropdownMenu', 'visible', val);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
show() {
|
||||
clearTimeout(this.timeout);
|
||||
@ -74,8 +83,7 @@
|
||||
},
|
||||
|
||||
render(h) {
|
||||
let { hide, splitButton, visible, type } = this;
|
||||
let dropdownElm = visible ? this.$slots.dropdown : null;
|
||||
let { hide, splitButton, type } = this;
|
||||
|
||||
var handleClick = _ => {
|
||||
this.$emit('click');
|
||||
@ -95,9 +103,7 @@
|
||||
return (
|
||||
<div class="el-dropdown" v-clickoutside={hide}>
|
||||
{triggerElm}
|
||||
<transition name="md-fade-bottom">
|
||||
{dropdownElm}
|
||||
</transition>
|
||||
{this.$slots.dropdown}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -46,13 +46,6 @@ export default {
|
||||
transition: {
|
||||
type: String,
|
||||
default: 'fade-in-linear'
|
||||
},
|
||||
options: {
|
||||
default() {
|
||||
return {
|
||||
gpuAcceleration: false
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
0
packages/theme-default/src/dropdown-menu.css
Normal file
0
packages/theme-default/src/dropdown-menu.css
Normal file
@ -9,6 +9,7 @@
|
||||
@import "./radio.css";
|
||||
@import "./switch.css";
|
||||
@import "./dropdown.css";
|
||||
@import "./dropdown-menu.css";
|
||||
@import "./loading.css";
|
||||
@import "./dialog.css";
|
||||
@import "./table.css";
|
||||
|
@ -34,7 +34,9 @@ export default {
|
||||
options: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
return {
|
||||
gpuAcceleration: false
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user