This commit is contained in:
Zhoujianlu 2020-12-05 03:55:52 -08:00 committed by GitHub
commit 69b75cdc58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -7,8 +7,8 @@ import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/re
* bottomOffset: 30(default) // The height of the table from the bottom of the page. * bottomOffset: 30(default) // The height of the table from the bottom of the page.
*/ */
const doResize = (el, binding, vnode) => { const doResize = async(el, binding, vnode) => {
const { componentInstance: $table } = vnode const { componentInstance: $table } = await vnode
const { value } = binding const { value } = binding
@ -25,17 +25,18 @@ const doResize = (el, binding, vnode) => {
} }
export default { export default {
bind(el, binding, vnode) { async bind(el, binding, vnode) {
el.resizeListener = () => { el.resizeListener = async() => {
doResize(el, binding, vnode) await doResize(el, binding, vnode)
} }
// parameter 1 is must be "Element" type // parameter 1 is must be "Element" type
addResizeListener(el, el.resizeListener)
addResizeListener(window.document.body, el.resizeListener) addResizeListener(window.document.body, el.resizeListener)
}, },
inserted(el, binding, vnode) { async inserted(el, binding, vnode) {
doResize(el, binding, vnode) await doResize(el, binding, vnode)
}, },
unbind(el) { unbind(el) {
removeResizeListener(window.document.body, el.resizeListener) removeResizeListener(el, el.resizeListener)
} }
} }