基本成型
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import envConfig from "../../env";
|
||||
|
||||
Component({
|
||||
data: {
|
||||
processedCardsData: [] as any[]
|
||||
processedCardsData: [] as any[],
|
||||
refresherTriggered: false,
|
||||
url:""
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
@@ -11,6 +15,10 @@ Component({
|
||||
}).catch(err => {
|
||||
wx.showToast({ title: '加载失败', icon: 'none' });
|
||||
});
|
||||
const apiBaseUrl = `${envConfig.apiBaseUrl}`;
|
||||
this.setData({
|
||||
url:apiBaseUrl
|
||||
})
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -119,13 +127,47 @@ Component({
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
goToDetail(e: { currentTarget: { dataset: { id: any; }; }; }) {
|
||||
},
|
||||
goToDetail(e: { currentTarget: { dataset: { id: any; }; }; }) {
|
||||
const id = e.currentTarget.dataset.id;
|
||||
console.log(id)
|
||||
wx.navigateTo({
|
||||
url: `/pages/articledetail/articledetail?id=${id}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onRefresherPulling() {
|
||||
console.log("正在下拉...");
|
||||
},
|
||||
onRefresherRestore() {
|
||||
console.log("刷新完成,已恢复原位");
|
||||
},
|
||||
onRefresherRefresh() {
|
||||
console.log("用户文评刷新")
|
||||
this.setData({
|
||||
refresherTriggered: true
|
||||
});
|
||||
const app = getApp();
|
||||
setTimeout(()=>{
|
||||
app.fetchRawCardData().then(cards => {
|
||||
this.setData({ processedCardsData: cards });
|
||||
this.setData({
|
||||
refresherTriggered: false
|
||||
});
|
||||
|
||||
}).catch(err => {
|
||||
wx.showToast({ title: '加载失败', icon: 'none' });
|
||||
this.setData({
|
||||
refresherTriggered: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
},2000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user