123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <div class="user-library">
- <van-tabs
- :title-active-color="tabConf.titleActiveColor"
- :title-inactive-color="tabConf.titleInactiveColor"
- :line-width="tabConf.lineWidth"
- :color="tabConf.color"
- v-model="tabActive"
- >
- <van-tab title="我的文库" name="0">
- <van-list
- v-model="myLibListState.loading"
- :finished="myLibListState.finished"
- finished-text="没有更多了"
- @load="onLoad('0')"
- >
- 00000
- </van-list>
- </van-tab>
- <van-tab title="文库收藏" name="1">
- <van-list
- v-model="myCollectionListState.loading"
- :finished="myCollectionListState.finished"
- finished-text="没有更多了"
- @load="onLoad('1')"
- >
- 1111
- </van-list>
- </van-tab>
- </van-tabs>
- </div>
- </template>
- <script lang="ts">
- import { Component, Vue } from 'vue-property-decorator'
- import { Tabs, Tab, List } from 'vant'
- import { mapActions, mapState } from 'vuex'
- @Component({
- name: 'user-library',
- components: {
- [Tabs.name]: Tabs,
- [Tab.name]: Tab,
- [List.name]: List
- },
- computed: {
- ...mapState('main', {
- userLibInfo: (state: any) => state.userLib
- })
- },
- methods: {
- ...mapActions({
- getList: 'main/getMyLibList'
- })
- }
- })
- export default class UserLibrary extends Vue {
- getList: any
- tabActive = '0'
- tabConf = {
- titleActiveColor: '#2ABED1',
- titleInactiveColor: '#5F5E64',
- lineWidth: '24',
- color: '#2ABED1'
- }
- myLibListState = {
- loading: false,
- finished: false,
- pageNum: 1,
- pageSize: 10,
- offset: 80,
- scrollTop: 0,
- list: []
- }
- myCollectionListState = {
- loading: false,
- finished: false,
- pageNum: 1,
- pageSize: 10,
- offset: 80,
- scrollTop: 0,
- list: []
- }
- created () {
- this.tabActive = this.$route.query.tab as string
- this.getList({})
- }
- onLoad (tab: string) {
- console.log(tab)
- }
- }
- </script>
- <style lang="scss" scoped>
- .user-library {
- ::v-deep {
- .van-tabs__wrap {
- height: 48px;
- }
- .van-tabs__line {
- bottom: 18px;
- }
- .van-tabs {
- width: 100%;
- }
- .van-tab {
- font-size: 16px;
- line-height: 20px;
- }
- }
- }
- </style>
|