通过ref使元素动态高度

observeResize() {
                this.$nextTick(() => {
                    const moreEditBoxHeight = new ResizeObserver(entries => {
                        for (let entry of entries) {
                            // 执行其他操作
                             let windowHeight = document.documentElement.clientHeight || document.bodyclientHeight;
                            this.tableHeight = windowHeight - 318 - entry.contentRect.height;//数值根据需要调整
                        }
                    });
                    moreEditBoxHeight.observe(this.$refs.moreEditBox);
                })
}

你可能感兴趣的:(前端,javascript,开发语言)