提交 5c285042 编写于 作者: W wangjinxin613

Merge branch 'dev' of gitcode.net:dcloud/hello-uvue into dev

...@@ -161,7 +161,7 @@ describe("shot-compare", () => { ...@@ -161,7 +161,7 @@ describe("shot-compare", () => {
// set webview-screenshot-comparison page baseSrc // set webview-screenshot-comparison page baseSrc
baseSrc = baseSrc =
process.env.UNI_WEB_SERVICE_URL ? `${process.env.UNI_WEB_SERVICE_URL}/#/` : process.env.UNI_WEB_SERVICE_URL ? `${process.env.UNI_WEB_SERVICE_URL}/#/` :
"http://192.168.31.223:5173/#/"; "http://test.dcloud.io/unix_h5_build/98_dev_hello-uvue/#/";
page.setData({ page.setData({
baseSrc, baseSrc,
}); });
...@@ -217,7 +217,7 @@ describe("shot-compare", () => { ...@@ -217,7 +217,7 @@ describe("shot-compare", () => {
const isLoaded = await page.data("isLoaded"); const isLoaded = await page.data("isLoaded");
return isLoaded || Date.now() - startTime > 3000; return isLoaded || Date.now() - startTime > 3000;
}); });
await page.waitFor(4500); await page.waitFor(800);
// web 端非 adb 截图时设置 offsetY 移除导航栏 // web 端非 adb 截图时设置 offsetY 移除导航栏
const webSnapshot = await program.screenshot({ const webSnapshot = await program.screenshot({
......
...@@ -27,33 +27,15 @@ ...@@ -27,33 +27,15 @@
this.webviewContext = uni.createWebviewContext('webview-screenshot-comparison', this) this.webviewContext = uni.createWebviewContext('webview-screenshot-comparison', this)
}, },
methods: { methods: {
customNavigationBarPageAppendWebHeadPlaceholder() {
if (this.src.indexOf('pages/template/navbar-lite/navbar-lite') > -1) {
this.webviewContext?.evalJS(`
const uniNavbar = document.querySelector('.uni-navbar');
uniNavbar.style.paddingTop = '${this.statusBarHeight}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';
`)
}
},
loaded() { loaded() {
this.isLoaded = true this.isLoaded = true
this.customNavigationBarPageAppendWebHeadPlaceholder();
}, },
error(event : WebViewErrorEvent) { error(event : WebViewErrorEvent) {
console.log('webview load error', JSON.stringify(event.detail)); console.log('webview load error', JSON.stringify(event.detail));
}, },
getWindowInfo() { getWindowInfo() {
const res = uni.getWindowInfo(); const res = uni.getWindowInfo();
// 获取状态栏+导航栏高度, 供截图对比使用 // 获取状态栏, 供截图对比使用
this.statusBarHeight = res.statusBarHeight; this.statusBarHeight = res.statusBarHeight;
}, },
getDeviceInfo: function () { getDeviceInfo: function () {
......
...@@ -152,7 +152,7 @@ describe("shot-compare", () => { ...@@ -152,7 +152,7 @@ describe("shot-compare", () => {
// set webview-screenshot page baseSrc // set webview-screenshot page baseSrc
baseSrc = baseSrc =
process.env.UNI_WEB_SERVICE_URL ? `${process.env.UNI_WEB_SERVICE_URL}/#/` : process.env.UNI_WEB_SERVICE_URL ? `${process.env.UNI_WEB_SERVICE_URL}/#/` :
"http://192.168.31.223:5173/#/"; "http://test.dcloud.io/unix_h5_build/98_dev_hello-uvue/#/";
page.setData({ page.setData({
baseSrc, baseSrc,
}); });
...@@ -208,8 +208,7 @@ describe("shot-compare", () => { ...@@ -208,8 +208,7 @@ describe("shot-compare", () => {
const isLoaded = await page.data("isLoaded"); const isLoaded = await page.data("isLoaded");
return isLoaded || Date.now() - startTime > 3000; return isLoaded || Date.now() - startTime > 3000;
}); });
await page.waitFor(800);
await page.waitFor(5000)
// web 端非 adb 截图时设置 offsetY 移除导航栏 // web 端非 adb 截图时设置 offsetY 移除导航栏
const webSnapshot = await program.screenshot({ const webSnapshot = await program.screenshot({
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
}, },
getWindowInfo() { getWindowInfo() {
const res = uni.getWindowInfo(); const res = uni.getWindowInfo();
// 获取状态栏+导航栏高度, 供截图对比使用 // 获取状态栏, 供截图对比使用
this.headerHeight = res.statusBarHeight; this.headerHeight = res.statusBarHeight;
}, },
getDeviceInfo: function () { getDeviceInfo: function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册