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

get-window-info 示例展示优化

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