Library.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class="user-library">
  3. <van-tabs
  4. :title-active-color="tabConf.titleActiveColor"
  5. :title-inactive-color="tabConf.titleInactiveColor"
  6. :line-width="tabConf.lineWidth"
  7. :color="tabConf.color"
  8. v-model="tabActive"
  9. >
  10. <van-tab title="我的文库" name="0">
  11. <van-list
  12. v-model="myLibListState.loading"
  13. :finished="myLibListState.finished"
  14. finished-text="没有更多了"
  15. @load="onLoad('0')"
  16. >
  17. 00000
  18. </van-list>
  19. </van-tab>
  20. <van-tab title="文库收藏" name="1">
  21. <van-list
  22. v-model="myCollectionListState.loading"
  23. :finished="myCollectionListState.finished"
  24. finished-text="没有更多了"
  25. @load="onLoad('1')"
  26. >
  27. 1111
  28. </van-list>
  29. </van-tab>
  30. </van-tabs>
  31. </div>
  32. </template>
  33. <script lang="ts">
  34. import { Component, Vue } from 'vue-property-decorator'
  35. import { Tabs, Tab, List } from 'vant'
  36. import { mapActions, mapState } from 'vuex'
  37. @Component({
  38. name: 'user-library',
  39. components: {
  40. [Tabs.name]: Tabs,
  41. [Tab.name]: Tab,
  42. [List.name]: List
  43. },
  44. computed: {
  45. ...mapState('main', {
  46. userLibInfo: (state: any) => state.userLib
  47. })
  48. },
  49. methods: {
  50. ...mapActions({
  51. getList: 'main/getMyLibList'
  52. })
  53. }
  54. })
  55. export default class UserLibrary extends Vue {
  56. getList: any
  57. tabActive = '0'
  58. tabConf = {
  59. titleActiveColor: '#2ABED1',
  60. titleInactiveColor: '#5F5E64',
  61. lineWidth: '24',
  62. color: '#2ABED1'
  63. }
  64. myLibListState = {
  65. loading: false,
  66. finished: false,
  67. pageNum: 1,
  68. pageSize: 10,
  69. offset: 80,
  70. scrollTop: 0,
  71. list: []
  72. }
  73. myCollectionListState = {
  74. loading: false,
  75. finished: false,
  76. pageNum: 1,
  77. pageSize: 10,
  78. offset: 80,
  79. scrollTop: 0,
  80. list: []
  81. }
  82. created () {
  83. this.tabActive = this.$route.query.tab as string
  84. this.getList({})
  85. }
  86. onLoad (tab: string) {
  87. console.log(tab)
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .user-library {
  93. ::v-deep {
  94. .van-tabs__wrap {
  95. height: 48px;
  96. }
  97. .van-tabs__line {
  98. bottom: 18px;
  99. }
  100. .van-tabs {
  101. width: 100%;
  102. }
  103. .van-tab {
  104. font-size: 16px;
  105. line-height: 20px;
  106. }
  107. }
  108. }
  109. </style>