4.10更新

This commit is contained in:
hrx 2026-04-10 17:36:17 +08:00
parent 70ee0e1bba
commit ca27783bb2
2 changed files with 45 additions and 0 deletions

View File

@ -217,6 +217,7 @@ onUnmounted(() => {
flex: 1;
min-height: 0;
overflow-y: auto;
padding-bottom: 96px;
}
.create-button-container {
z-index: 999;
@ -225,6 +226,7 @@ onUnmounted(() => {
left: 0;
width: 100%;
padding: 16px;
pointer-events: none;
// background: linear-gradient(180deg, rgba(2, 11, 19, 0) 0%, #0f0f19 100%);
// position: relative;
}
@ -243,6 +245,7 @@ onUnmounted(() => {
font-weight: 600 !important;
cursor: pointer;
transition: all 0.2s;
pointer-events: auto;
}
.create-button .price-info {
font-size: 16px;

42
src/utlis/debounce.ts Normal file
View File

@ -0,0 +1,42 @@
export type DebouncedFunction<T extends (...args: any[]) => any> = ((
...args: Parameters<T>
) => void) & {
cancel: () => void;
};
export const debounce = <T extends (...args: any[]) => any>(
fn: T,
wait = 300,
immediate = true
): DebouncedFunction<T> => {
let timer: ReturnType<typeof setTimeout> | null = null;
const debounced = ((...args: Parameters<T>) => {
const shouldCallNow = immediate && timer === null;
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
timer = null;
if (!immediate) {
void fn(...args);
}
}, wait);
if (shouldCallNow) {
void fn(...args);
}
}) as DebouncedFunction<T>;
debounced.cancel = () => {
if (!timer) return;
clearTimeout(timer);
timer = null;
};
return debounced;
};