mirror of https://github.com/ElemeFE/element
Select: add resize event
parent
9e0afd3835
commit
70aed33c69
|
@ -15,6 +15,7 @@ Object.keys(dependencies).forEach(function (key) {
|
||||||
externals['element-ui/src/utils/clickoutside'] = 'element-ui/lib/utils/clickoutside';
|
externals['element-ui/src/utils/clickoutside'] = 'element-ui/lib/utils/clickoutside';
|
||||||
externals['element-ui/src/utils/popper'] = 'element-ui/lib/utils/popper';
|
externals['element-ui/src/utils/popper'] = 'element-ui/lib/utils/popper';
|
||||||
externals['element-ui/src/utils/vue-popper'] = 'element-ui/lib/utils/vue-popper';
|
externals['element-ui/src/utils/vue-popper'] = 'element-ui/lib/utils/vue-popper';
|
||||||
|
externals['element-ui/src/utils/resize-event'] = 'element-ui/lib/utils/resize-event';
|
||||||
|
|
||||||
exports.externals = Object.assign({
|
exports.externals = Object.assign({
|
||||||
vue: 'vue'
|
vue: 'vue'
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
import debounce from 'throttle-debounce/debounce';
|
import debounce from 'throttle-debounce/debounce';
|
||||||
import Clickoutside from 'element-ui/src/utils/clickoutside';
|
import Clickoutside from 'element-ui/src/utils/clickoutside';
|
||||||
import { addClass, removeClass, hasClass } from 'wind-dom/src/class';
|
import { addClass, removeClass, hasClass } from 'wind-dom/src/class';
|
||||||
|
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [emitter],
|
mixins: [emitter],
|
||||||
|
@ -505,6 +506,10 @@
|
||||||
this.options.splice(index, 1);
|
this.options.splice(index, 1);
|
||||||
}
|
}
|
||||||
this.broadcast('option', 'resetIndex');
|
this.broadcast('option', 'resetIndex');
|
||||||
|
},
|
||||||
|
|
||||||
|
resetInputWidth() {
|
||||||
|
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -528,6 +533,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
addResizeListener(this.$el, this.resetInputWidth);
|
||||||
if (this.remote && this.multiple && Array.isArray(this.value)) {
|
if (this.remote && this.multiple && Array.isArray(this.value)) {
|
||||||
this.selected = this.options.reduce((prev, curr) => {
|
this.selected = this.options.reduce((prev, curr) => {
|
||||||
return this.value.indexOf(curr.value) > -1 ? prev.concat(curr) : prev;
|
return this.value.indexOf(curr.value) > -1 ? prev.concat(curr) : prev;
|
||||||
|
@ -541,6 +547,10 @@
|
||||||
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
destroyed() {
|
||||||
|
if (this.resetInputWidth) removeResizeListener(this.$el, this.resetInputWidth);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<script type="text/babel">
|
<script type="text/babel">
|
||||||
import throttle from 'throttle-debounce/throttle';
|
import throttle from 'throttle-debounce/throttle';
|
||||||
import debounce from 'throttle-debounce/debounce';
|
import debounce from 'throttle-debounce/debounce';
|
||||||
import { addResizeListener, removeResizeListener } from './resize-event';
|
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
|
||||||
import TableStore from './table-store';
|
import TableStore from './table-store';
|
||||||
import TableLayout from './table-layout';
|
import TableLayout from './table-layout';
|
||||||
import TableBody from './table-body';
|
import TableBody from './table-body';
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
@e tags {
|
@e tags {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
|
white-space: normal;
|
||||||
z-index: var(--index-top);
|
z-index: var(--index-top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue