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

fix: 适配json的变动,消除编译报错。

上级 cab95603
......@@ -41,7 +41,7 @@
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result.forEach((value, key) => {
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
......
......@@ -60,7 +60,7 @@ export default {
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result.forEach((value, key) => {
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
......
......@@ -61,7 +61,7 @@ export default {
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result.forEach((value, key) => {
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
......
......@@ -41,7 +41,7 @@
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
this.items = [] as Item[];
result.forEach((value, key) => {
result?.forEach((value, key) => {
const item = {
label: key,
value: "" + value
......
......@@ -53,26 +53,28 @@
success:function(result){
const content = result.data;
const items = [] as Item[];
const jsonArr = JSON.parse(content);
jsonArr?.forEach((res)=>{
const json = res as UTSJSONObject;
const title = json["title"] as string;
const subTitle = json["subTitle"] as string;
const img = json["img"] as string;
const detail = json["detail"] as string;
const item:Item = {
title,
subTitle,
img,
detail
const jsonArr = JSON.parse<Array<UTSJSONObject>>(content);
if(jsonArr != null){
for(const res in jsonArr){
const json = res as UTSJSONObject;
const title = json["title"] as string;
const subTitle = json["subTitle"] as string;
const img = json["img"] as string;
const detail = json["detail"] as string;
const item:Item = {
title,
subTitle,
img,
detail
}
items.push(item);
}
items.push(item);
})
let temp = [] as Item[];
for(let i = 0; i < 100; i++){
temp = temp.concat(items);
let temp = [] as Item[];
for(let i = 0; i < 100; i++){
temp = temp.concat(items);
}
listData = temp;
}
listData = temp;
setTimeout(()=>{
this.refresherTriggered = false
},0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册