提交 47d2beb8 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

fix: 修改getsysteminfo等api的实现方式、处理报错警告

上级 a4741c42
......@@ -37,17 +37,16 @@
methods: {
getAppBaseInfo: function () {
const res = uni.getAppBaseInfo();
//类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(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);
}
}
}
}
}
......
......@@ -56,17 +56,16 @@ export default {
methods: {
getDeviceInfo: function () {
const res = uni.getDeviceInfo();
//类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(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);
}
}
}
}
}
......
......@@ -56,18 +56,17 @@ export default {
methods: {
getSystemInfo: function () {
uni.getSystemInfo({
success: (res) => {
//类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(item);
})
success: (res) => {
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);
}
}
},
})
}
......
......@@ -37,17 +37,16 @@
methods: {
getWindowInfo: function () {
const res = uni.getWindowInfo();
//类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(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);
}
}
}
}
}
......
......@@ -137,7 +137,7 @@ export default {
uni.sendSocketMessage({
data:
'from ' +
platform +
this.platform +
' : ' +
parseInt((Math.random() * 10000).toString()).toString(),
success(res: any) {
......
......@@ -17,8 +17,10 @@
content: "",
}
},
onLoad(event) {
this.content = event["content"] ?? "";
onLoad(event) {
if(event != null){
this.content = event["content"] ?? "";
}
},
methods: {
}
......
......@@ -73,7 +73,7 @@
for(let i = 0; i < 100; i++){
temp = temp.concat(items);
}
listData = temp;
this.listData = temp;
}
setTimeout(()=>{
this.refresherTriggered = false
......
......@@ -54,7 +54,6 @@
</view>
</view>
<!-- //todo 还有自定义下拉刷新样式的例子 -->
<view class="uni-common-pb"></view>
</scroll-view>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册