SearchStore.ts 555 B

12345678910111213141516171819202122
  1. import { types } from 'mobx-state-tree';
  2. import { SearchResultSection } from './SearchResultSection';
  3. export const SearchStore = types
  4. .model('SearchStore', {
  5. sections: types.array(SearchResultSection),
  6. })
  7. .actions(self => ({
  8. query() {
  9. for (let i = 0; i < 100; i++) {
  10. self.sections.push(
  11. SearchResultSection.create({
  12. id: 'starred' + i,
  13. title: 'starred',
  14. icon: 'fa fa-fw fa-star-o',
  15. expanded: false,
  16. items: [],
  17. })
  18. );
  19. }
  20. },
  21. }));