File tree 3 files changed +25
-5
lines changed
3 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 2
2
import { NIcon } from ' naive-ui' ;
3
3
4
4
import IconLoadingMatrix from ' ~/components/icons/IconLoadingMatrix.vue' ;
5
+
6
+ defineProps ({
7
+ size: {
8
+ type: String ,
9
+ required: false ,
10
+ default: ' 3rem' ,
11
+ },
12
+ minHeight: {
13
+ type: String ,
14
+ required: false ,
15
+ },
16
+ });
5
17
</script >
6
18
7
19
<template >
8
- <NIcon class =" loading-container" size =" 3rem " >
20
+ <NIcon class =" loading-container" :style = " { '--min-height': minHeight } " : size =" size " >
9
21
<IconLoadingMatrix />
10
22
</NIcon >
11
23
</template >
@@ -19,6 +31,7 @@ import IconLoadingMatrix from '~/components/icons/IconLoadingMatrix.vue';
19
31
justify-content : center ;
20
32
width : 100% ;
21
33
height : 100% ;
34
+ min-height : var (--min-height , 0 );
22
35
padding-bottom : layout .$header-navbar-height ;
23
36
opacity : 1 ;
24
37
transition : opacity 1s ease-in 0.2s ;
Original file line number Diff line number Diff line change @@ -145,7 +145,10 @@ onDeactivated(() => {
145
145
:ref =" section.reference"
146
146
class =" card"
147
147
:class =" { target: focus?.title === section.title }"
148
- :style =" { '--length': sections.length, '--index': index }"
148
+ :style =" {
149
+ '--length': sections.length,
150
+ '--index': index,
151
+ }"
149
152
:title =" i18n(section.title)"
150
153
@mouseenter =" onEnter(section)"
151
154
@mouseleave =" onLeave(section)"
@@ -155,7 +158,7 @@ onDeactivated(() => {
155
158
<Suspense >
156
159
<component :is =" section.component" />
157
160
<template #fallback >
158
- <PageLoading />
161
+ <PageLoading min-height = " var(--height-40-dvh) " />
159
162
</template >
160
163
</Suspense >
161
164
</NCard >
Original file line number Diff line number Diff line change @@ -134,10 +134,14 @@ export const useCalendar = ({
134
134
list,
135
135
centerItem,
136
136
fetchData,
137
+ itemSize = 145 ,
138
+ placeholders = 1 ,
137
139
} : {
138
140
list : Ref < ListScrollItem [ ] > ;
139
141
centerItem : Ref < ListScrollItem | undefined > ;
140
142
fetchData : ( mode ?: 'start' | 'end' | 'reload' ) => Promise < unknown > ;
143
+ itemSize ?: number ;
144
+ placeholders ?: number ;
141
145
} ) => {
142
146
const listRef = ref < { list : VirtualListRef } > ( ) ;
143
147
const scrollTo = ( options ?: VirtualListScrollToOptions , index = centerItem . value ?. index ) => {
@@ -169,14 +173,14 @@ export const useCalendar = ({
169
173
let placeholder = 0 ;
170
174
const timeout = setTimeout ( ( ) => {
171
175
listRef . value ?. list . scrollTo ( { top : 145 } ) ;
172
- placeholder = 1 ;
176
+ placeholder = placeholders ;
173
177
} , defaultDebounceLoadingDelay ) ; // default debounceLoading delay
174
178
175
179
await fetching ;
176
180
177
181
clearTimeout ( timeout ) ;
178
182
listRef . value ?. list . scrollTo ( {
179
- top : ( list . value . findIndex ( item => item . id === first . id ) - placeholder ) * 145 ,
183
+ top : ( list . value . findIndex ( item => item . id === first . id ) - placeholder ) * itemSize ,
180
184
} ) ;
181
185
placeholder = 0 ;
182
186
} ;
You can’t perform that action at this time.
0 commit comments