feat: 整体页面优化,删除无用svg
This commit is contained in:
+24
-3
@@ -12,7 +12,8 @@ Page({
|
||||
pageSize: 6,
|
||||
total: 0,
|
||||
isLastPage: false,
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
scrollTop: 0
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -66,9 +67,23 @@ Page({
|
||||
const mappedList = list.map(item => {
|
||||
let imageUrl = '';
|
||||
if (item.imgList && item.imgList.length > 0) {
|
||||
imageUrl = item.imgList[0].url;
|
||||
imageUrl = item.imgList[0].url || '';
|
||||
}
|
||||
return { ...item, images: [imageUrl] };
|
||||
|
||||
// Calculate days
|
||||
let days = 1;
|
||||
if (item.plantTime) {
|
||||
try {
|
||||
const start = new Date(item.plantTime).getTime();
|
||||
const now = Date.now();
|
||||
const diff = now - start;
|
||||
if (diff > 0) {
|
||||
days = Math.ceil(diff / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
return { ...item, images: [imageUrl], daysPlanted: days };
|
||||
});
|
||||
|
||||
this.setData({
|
||||
@@ -139,5 +154,11 @@ Page({
|
||||
return {
|
||||
title: '我的植物花园 - Sundynix Plant'
|
||||
};
|
||||
},
|
||||
|
||||
onTabItemTap() {
|
||||
// Reset scroll when switching to this tab
|
||||
// Use random small value to force data change detection
|
||||
this.setData({ scrollTop: Math.random() * 0.01 });
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user