You are viewing a single comment's thread from:

RE: SteemJS中文手册

in #starnote6 years ago

一般依据标签对文章进行分类。tags在json_metadata中,这是字符串,要先JSON.parse转成对象形式

getCategory() {
  let category_net = "songofera"
  for (let i = 0; i < 100; i++) {
      let data_str = this.posts[i].json_metadata
      let data_obj = JSON.parse(data_str)
      if(data_obj.tags.includes(category_net)) {
        this.afterposts.push(this.posts[i])
        console.log(898, this.posts[i])
      }
  }
}