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

fix: json遍历方式改变 ; 去掉Android平台专属的类型。

上级 93bcf092
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
</template> </template>
<script> <script>
import JSONObject from 'com.alibaba.fastjson.JSONObject';
import JSONArray from 'com.alibaba.fastjson.JSONArray';
type Banner = { type Banner = {
cover: string | null, cover: string | null,
title: string | null, title: string | null,
...@@ -40,8 +38,7 @@ ...@@ -40,8 +38,7 @@
published_at: string, published_at: string,
title: string title: string
} }
export default { export default {
data() { data() {
return { return {
...@@ -136,22 +133,19 @@ ...@@ -136,22 +133,19 @@
url: 'pages/component/list/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title url: 'pages/component/list/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title
}); });
}, },
setTime(items: UTSJSONObject): Item[] { setTime(items: UTSJSONObject): Item[] {
let newItems = [] as Item[]; let newItems = [] as Item[];
if (items.isJSONArray()) { items.forEach((res)=>{
const array = items.toJSONObject() as JSONArray; const e = res as UTSJSONObject;
for (let i = array.size - 1; i >= 0; i--) { newItems.push({
const e = array.get(i) as JSONObject; author_name: e["author_name"] as string,
newItems.push({ cover: e["cover"] as string,
author_name: e["author_name"] as string, id: e["id"] as number,
cover: e["cover"] as string, post_id: e["post_id"] as string,
id: e["id"] as number, published_at: e["published_at"] as string,
post_id: e["post_id"] as string, title: e["title"] as string
published_at: e["published_at"] as string, } as Item);
title: e["title"] as string });
} as Item);
}
}
return newItems; return newItems;
}, },
onRefresherrefresh() { onRefresherrefresh() {
...@@ -159,7 +153,7 @@ ...@@ -159,7 +153,7 @@
this.refresherTriggered = true this.refresherTriggered = true
this.getBanner(); this.getBanner();
this.getList(); this.getList();
} }
} }
} }
}; };
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
</template> </template>
<script> <script>
import JSONObject from 'com.alibaba.fastjson.JSONObject';
import { readFile, ReadFileOptions,ReadFileSuccessResult } from '@/uni_modules/uts-file-manager'; import { readFile, ReadFileOptions,ReadFileSuccessResult } from '@/uni_modules/uts-file-manager';
type Item = { type Item = {
title: string title: string
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册