diff --git a/.vscode/settings.json b/.vscode/settings.json index f600293..d5624dc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ "prettier.enable": false, "typescript.tsdk": "node_modules/typescript/lib", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "files.associations": { "*.css": "postcss" diff --git a/src/scroll/scrollToTop.ts b/src/scroll/scrollToTop.ts index 5169a3c..f875c1e 100644 --- a/src/scroll/scrollToTop.ts +++ b/src/scroll/scrollToTop.ts @@ -10,9 +10,10 @@ export function scrollToTop() { const stop = useRaf(() => { const t = document.documentElement.scrollTop || document.body.scrollTop if (isUndef(pre)) pre = t - if ((pre < t && (pre * 8) / 7 !== t) || t === 0) stop() - if (t < 1) window.scrollTo(0, 0) - else window.scrollTo(0, (pre = (7 * t) / 8)) + if ((pre < t && (pre * 8) / 7 !== t) || t === 0) { + stop() + window.scrollTo(0, 0) + } else window.scrollTo(0, (pre = (7 * t) / 8)) }, 0) } catch (error: any) { throw new Error(error) diff --git a/tsup.config.ts b/tsup.config.ts index e141162..a91c640 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -4,7 +4,6 @@ export default defineConfig({ name: 'tsup', target: 'node14', format: ['cjs', 'esm'], - minify: true, splitting: false, sourcemap: false, clean: true,