刘磊
2025-04-19 2f18780a16a68f7fc67dd3bca61b8d0aed7c8e1a
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
    <!-- #ifndef APP-NVUE -->
    <view class="uni-list">
        <slot />
    </view>
    <!-- #endif -->
    <!-- #ifdef APP-NVUE -->
    <list class="uni-list" :enableBackToTop="enableBackToTop" loadmoreoffset="15" :scroll-y="scrollY" @loadmore="loadMore">
        <slot />
    </list>
    <!-- #endif -->
</template>
 
<script>
    /**
     * List 列表
     * @description 列表组件
     * @tutorial https://ext.dcloud.net.cn/plugin?id=24
     */
    export default {
        name: 'UniList',
        'mp-weixin': {
            options: {
                multipleSlots: false
            }
        },
        props: {
            enableBackToTop: {
                type: [Boolean, String],
                default: false
            },
            scrollY: {
                type: [Boolean, String],
                default: false
            }
        },
        provide() {
            return {
                list: this
            }
        },
        created() {
            this.firstChildAppend = false
        },
        methods: {
            loadMore(e) {
                this.$emit("scrolltolower");
            }
        }
    }
</script>
<style scoped>
    .uni-list {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        background-color: #ffffff;
        position: relative;
        flex-direction: column;
        /* border-bottom-color: $uni-border-color;
 */
        /* border-bottom-style: solid;
 */
        /* border-bottom-width: 1px;
 */
    }
 
    /* #ifndef APP-NVUE */
    .uni-list:before {
        height: 0;
    }
 
    .uni-list:after {
        height: 0;
    }
 
    /* #endif */
</style>