渲染列表- 获取列表数据API封装-在src下的api里新建js文件 - 提供 文章 相关的接口调用的函数
-
获取列表数据API封装
新建
src/api/article.js
// 提供 文章 相关的接口调用的函数
import request from '@/utils/request'
/**
* 获取文章列表
* @param {Integer} channelId - 频道ID
* @param {String} timestamp - 时间戳(分页页码)
*/
export const getArticles = (channelId, timestamp) => {
return request('app/v1_1/articles', 'get', {
channel_id: channelId,
timestamp,
with_top: 1
})
}
- 当前频道
computed: {
activeChannel () {
return this.channels[this.activeIndex]
}
},