提交 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,
...@@ -41,7 +39,6 @@ ...@@ -41,7 +39,6 @@
title: string title: string
} }
export default { export default {
data() { data() {
return { return {
...@@ -138,10 +135,8 @@ ...@@ -138,10 +135,8 @@
}, },
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--) {
const e = array.get(i) as JSONObject;
newItems.push({ newItems.push({
author_name: e["author_name"] as string, author_name: e["author_name"] as string,
cover: e["cover"] as string, cover: e["cover"] as string,
...@@ -150,8 +145,7 @@ ...@@ -150,8 +145,7 @@
published_at: e["published_at"] as string, published_at: e["published_at"] as string,
title: e["title"] as string title: e["title"] as string
} as Item); } as Item);
} });
}
return newItems; return newItems;
}, },
onRefresherrefresh() { onRefresherrefresh() {
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册