RE: RE: SteemJS中文手册
You are viewing a single comment's thread from:

RE: SteemJS中文手册

Words
15
Reading
1 min
Listen
Play
7y

用户关注的作者们的最新文章列表

steem.api.getDiscussionsByFeed(query, function(err, result) {
  console.log(err, result)
})

eg:
getFeed(){
  let that = this
  let query = {tag: 'lemooljiang', limit: 20}
  this.steem.api.getDiscussionsByFeed(query, function(err, result) {
    that.posts = result
    //取到最后一篇文章的author和Permlink,做为下一次查询的起始点
    that.author = result[result.length - 1].author
    that.permlink = result[result.length - 1].permlink
    console.log(569, result)
  })
},

//获取更多
getNext(){
  let that = this
  let query = {tag: 'lemooljiang', limit: 20, start_author: this.author, start_permlink: this.permlink}
  this.steem.api.getDiscussionsByFeed(query, function(err, result) {
    result.forEach(post => {
      if (post.permlink != that.permlink) {
        that.posts.push(post)
      }
    })
    that.author = result[result.length - 1].author
    that.permlink = result[result.length - 1].permlink
    console.log(631, result)
    if(result.length == 1){
      alert('没有更多了!')
    }
  })
}