提交 6dca70bc 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

部分ext api展示排序优化

上级 2436f944
...@@ -35,8 +35,16 @@ ...@@ -35,8 +35,16 @@
methods: { methods: {
getAppBaseInfo: function () { getAppBaseInfo: function () {
const res = uni.getAppBaseInfo(); const res = uni.getAppBaseInfo();
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);
});
this.items = [] as Item[]; this.items = [] as Item[];
for(const key in res){ keys.sort().forEach( key => {
const value = res[key]; const value = res[key];
if(value != null){ if(value != null){
const item = { const item = {
...@@ -45,7 +53,8 @@ ...@@ -45,7 +53,8 @@
} as Item; } as Item;
this.items.push(item); this.items.push(item);
} }
} });
} }
} }
} }
......
...@@ -52,16 +52,24 @@ ...@@ -52,16 +52,24 @@
// 获取像素比, 供截图对比使用 // 获取像素比, 供截图对比使用
setDevicePixelRatio(res.devicePixelRatio !== null ? parseFloat(res.devicePixelRatio!) : 1) setDevicePixelRatio(res.devicePixelRatio !== null ? parseFloat(res.devicePixelRatio!) : 1)
this.items = [] as Item[]; this.items = [] as Item[];
for (const key in res) {
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]; const value = res[key];
if (value != null) { if(value != null){
const item = { const item = {
label: key, label: key,
value: "" + ((typeof value == "object") ? JSON.stringify(value) : value) value: "" + ((typeof value == "object")? JSON.stringify(value) : value)
} as Item; } as Item;
this.items.push(item); this.items.push(item);
} }
} });
} }
} }
} }
......
...@@ -52,32 +52,46 @@ ...@@ -52,32 +52,46 @@
uni.getSystemInfo({ uni.getSystemInfo({
success: (res) => { success: (res) => {
this.items = [] as Item[]; this.items = [] as Item[];
for (const key in res) { 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]; const value = res[key];
if (value != null) { if(value != null){
const item = { const item = {
label: key, label: key,
value: "" + ((typeof value == "object") ? JSON.stringify(value) : value) value: "" + ((typeof value == "object")? JSON.stringify(value) : value)
} as Item; } as Item;
this.items.push(item); this.items.push(item);
} }
} });
}, },
}) })
}, },
getSystemInfoSync: function () { getSystemInfoSync: function () {
this.items = [] as Item[]; this.items = [] as Item[];
const res = uni.getSystemInfoSync() const res = uni.getSystemInfoSync()
for (const key in res) { 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]; const value = res[key];
if (value != null) { if(value != null){
const item = { const item = {
label: key, label: key,
value: "" + ((typeof value == "object") ? JSON.stringify(value) : value) value: "" + ((typeof value == "object")? JSON.stringify(value) : value)
} as Item; } as Item;
this.items.push(item); this.items.push(item);
} }
} });
}, },
//自动化测试例专用 //自动化测试例专用
jest_getSystemInfo() : GetSystemInfoResult { jest_getSystemInfo() : GetSystemInfoResult {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册