提交 37928b42 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

get-window-info 示例展示优化

上级 6dca70bc
......@@ -42,17 +42,25 @@
const res = uni.getWindowInfo();
// 获取状态栏+导航栏高度, 供截图对比使用
setStatusBarHeight(res.statusBarHeight);
this.items = [] as Item[];
for (const key in res) {
const value = res[key];
if (value != null) {
const item = {
label: key,
value: "" + ((typeof value == "object") ? JSON.stringify(value) : value)
} as Item;
this.items.push(item);
}
}
this.items = [] as Item[];
const res_str = JSON.stringify(res);
const res_obj = JSON.parseObject(res_str);
const res_map = res_obj!.toMap();
let keys = [] as string[]
res_map.forEach((_, key) => {
keys.push(key);
});
keys.sort().forEach( key => {
const value = res[key];
if(value != null){
const item = {
label: key,
value: "" + ((typeof value == "object")? JSON.stringify(value) : value)
} as Item;
this.items.push(item);
}
});
},
//自动化测试例专用
jest_getWindowInfo() : GetWindowInfoResult {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册