提交 fe15de9c 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

fix: request请求改为泛型

上级 4d6d19f9
...@@ -62,19 +62,17 @@ ...@@ -62,19 +62,17 @@
let data = { let data = {
column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名 column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名
}; };
uni.request({ uni.request<Banner>({
url: 'https://unidemo.dcloud.net.cn/api/banner/36kr', url: 'https://unidemo.dcloud.net.cn/api/banner/36kr',
data: data, data: data,
success: data => { success: data => {
if(this.pageVisible){ if(this.pageVisible){
this.refresherTriggered = false this.refresherTriggered = false
if (data.statusCode == 200) { if (data.statusCode == 200) {
let result = data.data as UTSJSONObject; const result = data.data
this.banner = { if(result != null){
cover: result["cover"] as string, this.banner = result;
title: result["title"] as string, }
post_id: result["post_id"] as string
} as Banner;
} }
} }
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册