1. 程式人生 > 其它 >[BScroll warn]: Can not resolve the wrapper DOM. 的解決

[BScroll warn]: Can not resolve the wrapper DOM. 的解決

技術標籤:前端Vueweb

維護專案時,遇到錯誤如下:
[BScroll warn]: Can not resolve the wrapper DOM. Vue better-scroll
[Vue warn]: Error in mounted hook: “TypeError: Cannot read property ‘children’ of undefined”
報錯圖

問題分析:

BScroll 未獲得到 DOM

解決辦法:

1.找到使用BScroll 的地方,

專案中使用的如下:

import BScroll from 'bscroll';

initScroll() {
    let that = this;
// 表格頭部右側橫向滾動條 var headerRightDom = document.querySelector('.right-header-table'); }

2.找到“right-header-table”的節點

<div v-if="">
	<div class="right-header-table">
	</div>
</div>

問題就出在v-if 修改為v-show,報錯解決。