wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<template>
    <cl-page>
        <view class="page">
            <view class="list">
                <view class="item" v-for="item in list">
                    <comment-item :item="item" />
                </view>
 
                <cl-empty text="暂无评论" icon="message" v-if="isEmpty(list)" />
            </view>
        </view>
    </cl-page>
</template>
 
<script lang="ts" setup>
import { onMounted } from "vue";
import { useCool, usePager } from "/@/cool";
import { isEmpty } from "lodash-es";
import CommentItem from "./components/comment-item.vue";
 
const { service, router } = useCool();
const { list, onRefresh } = usePager<Eps.GoodsCommentEntity>();
 
function refresh(params?: any) {
    const { next, data } = onRefresh(params);
    next(service.goods.comment.page(data));
}
 
onMounted(() => {
    refresh({
        goodsId: router.query.goodsId,
    });
});
 
defineExpose({
    refresh,
});
</script>
 
<style lang="scss" scoped>
.page {
    padding: 24rpx;
 
    .list {
        .item {
            background-color: #fff;
            padding: 24rpx;
            border-radius: 24rpx;
            margin-bottom: 24rpx;
 
            &:last-child {
                margin-bottom: 0;
            }
        }
    }
}
</style>