fix: 修复 el-height-adaptive-table 指令刷新或切换 tagsView 后失效的 bug。

This commit is contained in:
Zhoujianlu 2020-04-21 17:41:41 +08:00
parent 9d8c7edf91
commit f917050b6d
1 changed files with 8 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,15 +25,15 @@ 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(window.document.body, el.resizeListener) await 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(window.document.body, el.resizeListener)