如何在Meteor中按类别选择文章?

时间:2016-08-02 10:10:50

标签: javascript mongodb meteor

我是初学者流星。我根据每个类别创建了一个包含许多帖子(文章)的博客。这是我的收藏:

if (Category.find().count() === 0) {
[
  {
    name: 'IT',
    sub_categories: [
      { name: 'Java' },
      { name: 'PHP' },
      { name: '.NET' },
      { name: 'Android/iOS' },
      { name: 'HTML/CSS' },
      { name: 'Javascript and Framworks' },
      { name: 'Ruby on Rails' },
    ],
  },
  {
    name: 'ENGLISH',
    sub_categories: [
      { name: 'Listening' },
      { name: 'Speaking' },
      { name: 'Writing' },
      { name: 'Reading' },
      { name: 'Topic' },
    ],
  },
  {
    name: 'SoftSkill',
    sub_categories: [
      { name: 'CV and CL' },
      { name: 'Presentation' },
      { name: 'Teamwork' },
    ],
  },
  {
    name: 'ENTERTAINMENT',
    sub_categories: [
      { name: 'Sports' },
      { name: 'Games' },
      { name: 'Music & Videos' },
      { name: 'Fashion' },
      { name: 'Talk show' },
    ],
  },
].forEach(doc => {
  Category.insert(doc);
});

}

按照每个类别保存所有帖子后,现在我想通过选择选项

显示它

enter image description here

详情

当我点击“IT”按钮 - > app显示所有sub_categories。然后我选择一个选项(例如“Java”),它将显示所有帖子都有sub_categories =“Java”。你能帮帮我吗?

1 个答案:

答案 0 :(得分:0)

您可以根据需要使用导航栏。

在该导航栏中,您可以将下拉列表作为导航栏元素 Please Follow this steps if it is useful for you