explore.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="explore ">
  3. <!-- 搜索 -->
  4. <view>
  5. <router-link
  6. :to="{path: '/bundle_b/pages/community_search/community_search'}">
  7. <u-search disabled
  8. bgColor="#fff" :hideRight="true"
  9. borderColor="#F73E33" placeholder="请输入搜索内容" height="64" focus
  10. ></u-search>
  11. </router-link>
  12. </view>
  13. <view class="content">
  14. <tabs :current="current" @change="changeTabs" height="100" >
  15. <tab v-for="(item, index) in tabList" :key="index" :name="item.name">
  16. <lists :cateId="item.id" :i="index" :index="current"></lists>
  17. </tab>
  18. </tabs>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. getCommunityCate,
  25. getCommunityArticleLists
  26. } from '@/api/community.js';
  27. import Lists from "./lists.vue"
  28. export default {
  29. components: {
  30. Lists
  31. },
  32. data() {
  33. return {
  34. tabList: [{
  35. name: '全部',
  36. id: ''
  37. }],
  38. current: 0
  39. }
  40. },
  41. created() {
  42. this.initRecommendTopic()
  43. },
  44. methods: {
  45. initMescroll(event) {
  46. this.isInit = true; // 标记为true
  47. this.mescroll = event;
  48. },
  49. handleCancel() {
  50. this.keyword = '';
  51. },
  52. // 切换标签导航
  53. changeTabs(event) {
  54. this.current = event;
  55. },
  56. // 初始化获取话题
  57. initRecommendTopic() {
  58. getCommunityCate().then(res => {
  59. if( res.code === 1 ) {
  60. this.tabList = [{
  61. name: '全部',
  62. id: ''
  63. }, ...res.data]
  64. } else {
  65. this.$toast({ title: res.msg })
  66. }
  67. })
  68. },
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .explore {
  74. border-radius: 20rpx;
  75. overflow: hidden;
  76. // pb
  77. .content {
  78. height: calc(100vh - 92px - var(--window-bottom));
  79. overflow: hidden;
  80. }
  81. }
  82. </style>