Your Name
2022-06-27 0a3027eccd3b0bb6542e5fc831f7e02740dcfc95
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<template>
    <div class="waterfall-container">
        <el-card shadow="hover" header="瀑布屏(布局一)" class="mb15">
            <div class="waterfall-first">
                <div class="waterfall-first-item" v-for="v in 30" :key="v" v-waves>
                    <div class="w100 h100 flex">
                        <span class="flex-margin">{{ v }}</span>
                    </div>
                </div>
            </div>
        </el-card>
        <el-card shadow="hover" header="瀑布屏(布局二)">
            <div class="waterfall-last">
                <div class="waterfall-last-item" v-for="v in 30" :key="v" v-waves="'light'">
                    <div class="w100 h100 flex">
                        <span class="flex-margin">{{ v }}</span>
                    </div>
                </div>
            </div>
        </el-card>
    </div>
</template>
 
<script lang="ts">
import { toRefs, reactive, defineComponent } from 'vue';
 
export default defineComponent({
    name: 'pagesWaterfall',
    setup() {
        const state = reactive({});
        return {
            ...toRefs(state),
        };
    },
});
</script>
 
<style scoped lang="scss">
.waterfall-container {
    .waterfall-first {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
        grid-gap: 0.25em;
        grid-auto-flow: row dense;
        grid-auto-rows: 20px;
        .waterfall-first-item {
            width: 100%;
            background: var(--el-color-primary);
            color: var(--el-color-white);
            transition: all 0.3s ease;
            border-radius: 3px;
            &:nth-of-type(3n + 1) {
                grid-row: auto / span 5;
            }
            &:nth-of-type(3n + 2) {
                grid-row: auto / span 6;
            }
            &:nth-of-type(3n + 3) {
                grid-row: auto / span 8;
            }
            &:hover {
                box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
                transition: all 0.3s ease;
                cursor: pointer;
            }
        }
    }
    .waterfall-last {
        display: grid;
        grid-gap: 0.25em;
        grid-auto-flow: row dense;
        grid-auto-rows: minmax(188px, 20vmin);
        grid-template-columns: 1fr;
        .waterfall-last-item {
            height: 100%;
            background: var(--el-color-primary);
            color: var(--el-color-white);
            transition: all 0.3s ease;
            border-radius: 3px;
            &:hover {
                box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
                transition: all 0.3s ease;
                cursor: pointer;
            }
        }
    }
    @media (min-width: 576px) {
        .waterfall-last {
            grid-template-columns: repeat(7, 1fr);
            .waterfall-last-item {
                &:nth-of-type(9n + 9) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(9n + 8) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(9n + 7) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(9n + 6) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(9n + 5) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(9n + 4) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(9n + 3) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(9n + 2) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(9n + 1) {
                    grid-column: auto / span 2;
                }
            }
        }
    }
    @media (min-width: 576px) and (min-width: 1024px) {
        .waterfall-last {
            grid-template-columns: repeat(14, 1fr);
            .waterfall-last-item {
                &:nth-of-type(15n + 15) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 14) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 13) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(15n + 12) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 11) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 10) {
                    grid-column: auto / span 2;
                }
                &:nth-of-type(15n + 9) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 8) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 7) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 6) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 5) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 4) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 3) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 2) {
                    grid-column: auto / span 3;
                }
                &:nth-of-type(15n + 1) {
                    grid-column: auto / span 2;
                }
            }
        }
    }
}
</style>