diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue b/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue index 0ead1c6e6e910c3edf70543e1febddab22d7b73b..c25418f7788b585cd8e51dd61b1036499153f3a8 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue @@ -1,6 +1,6 @@ @@ -22,37 +22,39 @@ } }, onReady() { - this.webviewContext = uni.createWebviewContext('webview-screenshot', this) + this.webviewContext = uni.createWebviewContext('webview-screenshot-comparison', this) }, methods: { appendWebHeadPlaceholder() { if (this.src.indexOf('pages/template/navbar-lite/navbar-lite') > -1) { this.webviewContext?.evalJS(` - const uniNavbar = document.querySelector('.uni-navbar'); - uniNavbar.style.paddingTop = '${state.headerHeight - 44}px'; - `) + const uniNavbar = document.querySelector('.uni-navbar'); + uniNavbar.style.paddingTop = '${state.headerHeight - 44}px'; + `) } else if (this.src.indexOf('pages/template/scroll-fold-nav/scroll-fold-nav') > -1) { this.webviewContext?.evalJS(` - const heightSeat = document.querySelector('.height-seat'); - heightSeat.style.height = '125px'; - heightSeat.style.backgroundColor = '#f0f8ff'; - const topBox = document.querySelector('.top-box'); - topBox.style.top = '35px'; - `) + const heightSeat = document.querySelector('.height-seat'); + heightSeat.style.height = '125px'; + heightSeat.style.backgroundColor = '#f0f8ff'; + const topBox = document.querySelector('.top-box'); + topBox.style.top = '35px'; + `) + } else if (this.src.indexOf('pages/template/pull-zoom-image/pull-zoom-image') > -1) { + return } else { this.webviewContext?.evalJS(` - const hasWebHeadPlaceholder = document.querySelector('.web-head-placeholder-for-screenshot-comparison'); - if (hasWebHeadPlaceholder) { - return; - } - const webHeadPlaceholder = document.createElement('div'); - webHeadPlaceholder.style.height = '${state.headerHeight - 44}px'; - webHeadPlaceholder.style.backgroundColor = '#007aff'; - webHeadPlaceholder.classList.add('web-head-placeholder-for-screenshot-comparison'); - const uniPage = document.querySelector('uni-page'); - const uniPageHead = document.querySelector('uni-page-head'); - uniPage.insertBefore(webHeadPlaceholder, uniPageHead); - `); +const hasWebHeadPlaceholder = document.querySelector('.web-head-placeholder-for-screenshot-comparison'); +if (hasWebHeadPlaceholder) { + return; +} +const webHeadPlaceholder = document.createElement('div'); +webHeadPlaceholder.style.height = '${state.headerHeight - 44}px'; +webHeadPlaceholder.style.backgroundColor = '#007aff'; +webHeadPlaceholder.classList.add('web-head-placeholder-for-screenshot-comparison'); +const uniPage = document.querySelector('uni-page'); +const uniPageHead = document.querySelector('uni-page-head'); +uniPage.insertBefore(webHeadPlaceholder, uniPageHead); +`); } }, loaded() { @@ -66,7 +68,7 @@ }