Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
54d5d1d8
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
54d5d1d8
编写于
1月 20, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 优化截图对比测试计算状态栏高度逻辑
上级
d3404d85
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
11 deletion
+11
-11
pages/API/get-window-info/get-window-info.uvue
pages/API/get-window-info/get-window-info.uvue
+1
-1
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
...reenshot-comparison/webview-screenshot-comparison.test.js
+2
-2
pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue
...-screenshot-comparison/webview-screenshot-comparison.uvue
+3
-3
store/index.uts
store/index.uts
+5
-5
未找到文件。
pages/API/get-window-info/get-window-info.uvue
浏览文件 @
54d5d1d8
...
...
@@ -40,7 +40,7 @@
getWindowInfo: function () {
const res = uni.getWindowInfo();
// 获取状态栏+导航栏高度, 供截图对比使用
set
HeaderHeight(res.screenHeight - res.window
Height);
set
StatusBarHeight(res.statusBar
Height);
this.items = [] as Item[];
for (const key in res) {
const value = res[key];
...
...
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
浏览文件 @
54d5d1d8
...
...
@@ -269,7 +269,7 @@ describe("shot-compare", () => {
const
isNeedAdbScreenshot
=
needAdbScreenshot
(
pages
[
pageIndex
]);
const
isCustomNavigationBar
=
customNavigationPages
.
includes
(
pages
[
pageIndex
]);
const
{
heade
rHeight
,
statusBa
rHeight
,
devicePixelRatio
}
=
await
page
.
data
();
const
screenshotParams
=
{
...
...
@@ -278,7 +278,7 @@ describe("shot-compare", () => {
// adb 截图时跳过状态栏
area
:
{
x
:
0
,
y
:
(
headerHeight
-
44
)
*
devicePixelRatio
,
y
:
statusBarHeight
*
devicePixelRatio
,
},
}
const
screenshotPath
=
`__webview__
${
pages
[
pageIndex
].
replace
(
/
\/
/g
,
"
-
"
)}
`
;
...
...
pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue
浏览文件 @
54d5d1d8
...
...
@@ -15,11 +15,11 @@
src: '',
webviewContext: null as WebviewContext | null,
isLoaded: false,
headerHeight: state.heade
rHeight,
statusBarHeight: state.statusBa
rHeight,
isCustomNavigationBar: false,
placeholderStyle: {
display: 'block',
height: `${state.
headerHeight - 44
}px`,
height: `${state.
statusBarHeight
}px`,
backgroundColor: '#007aff'
},
devicePixelRatio: state.devicePixelRatio,
...
...
@@ -36,7 +36,7 @@
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';
uniNavbar.style.paddingTop = '${state.
statusBarHeight
}px';
`)
} else if (this.src.indexOf('pages/template/scroll-fold-nav/scroll-fold-nav') > -1) {
this.webviewContext?.evalJS(`
...
...
store/index.uts
浏览文件 @
54d5d1d8
type State = {
lifeCycleNum : number,
// 状态栏
+ 导航栏
高度
heade
rHeight : number,
// 状态栏高度
statusBa
rHeight : number,
// 设备像素比
devicePixelRatio : number
}
export const state = reactive({ lifeCycleNum: 0,
heade
rHeight: 0, devicePixelRatio: 1 } as State)
export const state = reactive({ lifeCycleNum: 0,
statusBa
rHeight: 0, devicePixelRatio: 1 } as State)
export const setLifeCycleNum = (num : number) => {
state.lifeCycleNum = num
}
export const set
Heade
rHeight = (height : number) => {
state.
heade
rHeight = height
export const set
StatusBa
rHeight = (height : number) => {
state.
statusBa
rHeight = height
}
export const setDevicePixelRatio = (devicePixelRatio : number) => {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录