在onload里寫
this.requestTask = new Promise((resolve, reject) => {
_this.getDetail(id, resolve);
})
在onshow里調(diào)用
this.requestTask.then(requestData => {
// 可以直接通過框架提供的 getData 方法獲取到 data 字段值; 也可以通過 this.data.xxx 獲取
swan.setPageInfo({
title: _this.data.detailscon.f_title,
keywords: _this.data.detailscon.f_keywords,
description: _this.data.detailscon.f_abstract,
success: res => {
// console.log('setPageInfo success');
},
fail: err => {
console.log('setPageInfo fail', err);
}
})
})