You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 2.5 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div>
  3. <div>
  4. <SquareTop></SquareTop>
  5. </div>
  6. <div class="ui container">
  7. <SearchBar ref="searchBarRef" type="square" :sort="``" :searchValue="reposListQurey" :topic="``"
  8. @change="searchBarChange"></SearchBar>
  9. </div>
  10. <div class="recommend-repos-c">
  11. <RecommendRepos></RecommendRepos>
  12. </div>
  13. <div class="ui container">
  14. <div class="ui grid">
  15. <div class="computer only ui two wide computer column">
  16. <ReposFilters ref="reposFiltersRef" @change="filtersChange"></ReposFilters>
  17. </div>
  18. <div class="ui sixteen wide mobile twelve wide tablet ten wide computer column">
  19. <ReposList ref="reposListRef" :sort="reposListSortType" :q="reposListQurey" :topic="reposListTopic">
  20. </ReposList>
  21. </div>
  22. <div class="computer only ui four wide computer column">
  23. <div>
  24. <ActiveUsers></ActiveUsers>
  25. </div>
  26. <div class="active-org-c">
  27. <ActiveOrgs></ActiveOrgs>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import SquareTop from '../components/SquareTop.vue';
  36. import SearchBar from '../components/SearchBar.vue';
  37. import RecommendRepos from '../components/RecommendRepos.vue';
  38. import ReposFilters from '../components/ReposFilters.vue';
  39. import ReposList from '../components/ReposList.vue';
  40. import ActiveUsers from '../components/ActiveUsers.vue';
  41. import ActiveOrgs from '../components/ActiveOrgs.vue';
  42. export default {
  43. data() {
  44. return {
  45. reposListSortType: 'mostpopular',
  46. reposListQurey: '',
  47. reposListTopic: '',
  48. };
  49. },
  50. components: {
  51. SquareTop,
  52. SearchBar,
  53. RecommendRepos,
  54. ReposFilters,
  55. ReposList,
  56. ActiveUsers,
  57. ActiveOrgs,
  58. },
  59. methods: {
  60. filtersChange(condition) {
  61. this.reposListSortType = condition.key;
  62. this.search();
  63. },
  64. searchBarChange(params) {
  65. this.reposListQurey = params.q || '';
  66. this.reposListTopic = params.topic || '';
  67. this.search();
  68. },
  69. search() {
  70. this.$nextTick(() => {
  71. this.$refs.reposListRef.search();
  72. });
  73. }
  74. },
  75. mounted() {
  76. this.$nextTick(() => {
  77. this.$refs.searchBarRef.setDefaultSearch({
  78. q: '',
  79. topic: '',
  80. });
  81. this.search();
  82. });
  83. },
  84. beforeDestroy() { },
  85. };
  86. </script>
  87. <style scoped lang="less">
  88. .recommend-repos-c {
  89. margin: 0 0 54px;
  90. }
  91. .active-org-c {
  92. margin-top: 32px;
  93. }
  94. </style>