diff --git a/pages/API/get-app-base-info/get-app-base-info.uvue b/pages/API/get-app-base-info/get-app-base-info.uvue index 5fd302ee97d7244a300551861e267b2b0f3f0c63..4d603059b50b0226157bc3fa2a3a6b93997f9da7 100644 --- a/pages/API/get-app-base-info/get-app-base-info.uvue +++ b/pages/API/get-app-base-info/get-app-base-info.uvue @@ -41,7 +41,7 @@ const json = JSON.stringify(res); const result = JSON.parse>(json); this.items = [] as Item[]; - result.forEach((value, key) => { + result?.forEach((value, key) => { const item = { label: key, value: "" + value diff --git a/pages/API/get-device-info/get-device-info.uvue b/pages/API/get-device-info/get-device-info.uvue index 9f64d3d31a926a1954baec993d3c1fc8b7e16abe..69f3bdbc45b96a252dc9dfbb1fafd86785094a6c 100644 --- a/pages/API/get-device-info/get-device-info.uvue +++ b/pages/API/get-device-info/get-device-info.uvue @@ -60,7 +60,7 @@ export default { const json = JSON.stringify(res); const result = JSON.parse>(json); this.items = [] as Item[]; - result.forEach((value, key) => { + result?.forEach((value, key) => { const item = { label: key, value: "" + value diff --git a/pages/API/get-system-info/get-system-info.uvue b/pages/API/get-system-info/get-system-info.uvue index 62bfa7c3b7a6b09ccf13782d863528f1f2854688..7acbba04a8128614e2b278c5e914388579d32754 100644 --- a/pages/API/get-system-info/get-system-info.uvue +++ b/pages/API/get-system-info/get-system-info.uvue @@ -61,7 +61,7 @@ export default { const json = JSON.stringify(res); const result = JSON.parse>(json); this.items = [] as Item[]; - result.forEach((value, key) => { + result?.forEach((value, key) => { const item = { label: key, value: "" + value diff --git a/pages/API/get-window-info/get-window-info.uvue b/pages/API/get-window-info/get-window-info.uvue index 75b1d8aa965b034f94334d5887309bec84e435c4..42ffd05ddcde75bdf4b719759f61566fcba1e05f 100644 --- a/pages/API/get-window-info/get-window-info.uvue +++ b/pages/API/get-window-info/get-window-info.uvue @@ -41,7 +41,7 @@ const json = JSON.stringify(res); const result = JSON.parse>(json); this.items = [] as Item[]; - result.forEach((value, key) => { + result?.forEach((value, key) => { const item = { label: key, value: "" + value diff --git a/pages/component/long-list/long-list.uvue b/pages/component/long-list/long-list.uvue index 0f43351cdd840702276c59f472626da534530a60..ddd4132aef666fd10eccbe7116797c6f901d25b4 100644 --- a/pages/component/long-list/long-list.uvue +++ b/pages/component/long-list/long-list.uvue @@ -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>(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);