subscribe.vue
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!--
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-04-28 11:37:47
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-24 22:03:38
* @FilePath: /tswj/src/views/me/subscribe.vue
* @Description:
-->
<template>
<div class="subscribe-list">
<template v-for="(item) in items" :key="item.id">
<book-card :type="USER_ROLE.CLIENT" :item="item" @on-click="go('/client/bookDetail', { id: item.id })" />
</template>
</div>
<van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无订阅" />
</template>
<script setup>
import no_image from '@images/que-shuju@2x.png'
import BookCard from '@/components/BookCard/index.vue'
import { ref, onMounted } from 'vue'
import { useGo } from '@/hooks/useGo'
import { mySubscribeAPI } from '@/api/C/me'
import { USER_ROLE } from '@/constant'
const go = useGo()
const emptyStatus = ref(false);
const items = ref([]);
onMounted(async () => {
const { data, code } = await mySubscribeAPI()
if (code) {
items.value = data;
emptyStatus.value = data.length ? false : true;
}
})
</script>
<style lang="less" scoped>
</style>