笔记:「饭否精选·日历」微信小程序制作记录 - 微信小程序开发中遇到的问题 - 3
//
getStatus(statusid, date) {
if (this.statuses[statusid]) {
// 如果 Store.id 中本地缓存了数据,就直接从本地取出
return Promise.resolve(this.statuses[statusid]);
}
else {
// 如果没有,则请求服务器,获取对应数据
// 保存到本地 Store.store
// 最后返回
return this.getData()
.then($this => $this.getEntry(statusid, date).then((data) => {
return this.statuses[statusid];
}));
}
}