From 50b31675e9e31b0bdf75134d8f7730f008183651 Mon Sep 17 00:00:00 2001 From: liuzejia Date: Mon, 28 Oct 2024 18:56:51 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=A1=A5=E5=85=85=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../swiper-effect/src/pages/index/index.tsx | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/examples/swiper-effect/src/pages/index/index.tsx b/examples/swiper-effect/src/pages/index/index.tsx index 1e1a54272bf..45e1f8a9ae5 100644 --- a/examples/swiper-effect/src/pages/index/index.tsx +++ b/examples/swiper-effect/src/pages/index/index.tsx @@ -10,7 +10,6 @@ export default function Index() { const [displayMultipleItems, setDisplayMultipleItems] = useState(1) const [autoplay, setAutoplay] = useState(true) const [current, setCurrent] = useState(0) - const [current2, setCurrent2] = useState(0) const [arr, setArr] = useState([ {url: 'https://swiperjs.com/demos/images/nature-1.jpg'}, {url: 'https://swiperjs.com/demos/images/nature-2.jpg'}, @@ -42,34 +41,32 @@ export default function Index() { setArr([...arr ]) } - // const deleteCurrent = (current) => { - // arr.splice(current, 1) - // setArr([...arr]) - // } - - console.log('render???') + const deleteCurrent = (current) => { + arr.splice(current, 1) + setArr([...arr]) + } return ( - {/* */} + { - // const {current, source } = e.detail - // console.log('animation finish', current, source) + const {current, source } = e.detail + console.log('animation finish', current, source) }} onChange={(e) => { const {current, source} = e.detail console.log('change', current, source) - setCurrent2(current) + setCurrent(current) }} @@ -82,7 +79,7 @@ export default function Index() { - {/* */} + @@ -99,7 +96,7 @@ export default function Index() { - {/* */} + ) }