提交 8f771d4a 编写于 作者: Q qq_40591925

Auto Commit

上级 14c9fd22
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
const startTime = performance.now(); const startTime = performance.now();
const startScroll = Dom.scrollLeft; const startScroll = Dom.scrollLeft;
const duration = 150; const duration = 150;
isSnap.value = false;
const animate = (timestamp: number) => { const animate = (timestamp: number) => {
const progress = (timestamp - startTime) / duration; const progress = (timestamp - startTime) / duration;
if (progress < 1) { if (progress < 1) {
...@@ -38,6 +37,7 @@ ...@@ -38,6 +37,7 @@
const container = scrollContainer.value const container = scrollContainer.value
const containerWidth = container?.clientWidth || 0; const containerWidth = container?.clientWidth || 0;
const currentScroll = container?.scrollLeft || 0; const currentScroll = container?.scrollLeft || 0;
isSnap.value = false;
let scrollLeft = 0; let scrollLeft = 0;
if(type==='prev'){ if(type==='prev'){
scrollLeft = currentScroll - containerWidth; scrollLeft = currentScroll - containerWidth;
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
} }
scrollLeft=scrollLeft<0?0:scrollLeft scrollLeft=scrollLeft<0?0:scrollLeft
// 有动画 // 有动画
changeScroll(container as HTMLElement,scrollLeft) setTimeout(()=>{
changeScroll(container as HTMLElement, scrollLeft)
},0)
} }
const handleScroll = () => { const handleScroll = () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册