Popper: workaround for #3952 (#4062)

* Popper: workaround for #3952

* Changelog: update for 1.2.8
This commit is contained in:
杨奕
2017-04-07 18:36:24 +08:00
committed by baiyaaaaa
parent 24cd59ff7f
commit 6287da4ac3
9 changed files with 48 additions and 17 deletions

View File

@@ -25,11 +25,13 @@
<script>
import Popup from 'element-ui/src/utils/popup';
import throttle from 'throttle-debounce/throttle';
import emitter from 'element-ui/src/mixins/emitter';
export default {
name: 'ElDialog',
mixins: [Popup],
mixins: [Popup, emitter],
props: {
title: {
@@ -96,10 +98,12 @@
this.$emit('input', val);
if (val) {
this.$emit('open');
this.$el.addEventListener('scroll', this.throttledUpdatePopper);
this.$nextTick(() => {
this.$refs.dialog.scrollTop = 0;
});
} else {
this.$el.removeEventListener('scroll', this.throttledUpdatePopper);
this.$emit('close');
}
}
@@ -119,9 +123,17 @@
if (this.closeOnClickModal) {
this.close();
}
},
updatePopper() {
this.broadcast('ElSelectDropdown', 'updatePopper');
this.broadcast('ElDropdownMenu', 'updatePopper');
}
},
created() {
this.throttledUpdatePopper = throttle(100, this.updatePopper);
},
mounted() {
if (this.value) {
this.rendered = true;