index.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div>
  3. <van-nav-bar title="声音采集" left-arrow @click-left="onClickLeft"></van-nav-bar>
  4. <van-swipe ref="swipeRef" class="my-swipe" :autoplay="false" :duration="100" indicator-color="white" :show-indicators="false" :touchable="true" @change="handleChange">
  5. <van-swipe-item @click="handleNext(index)" v-for="(item, index) in imageList" :key="index"
  6. ><img class="w-full -mt-50px" :src="item" alt=""
  7. /></van-swipe-item>
  8. </van-swipe>
  9. </div>
  10. </template>
  11. <script setup>
  12. import img1 from "~/assets/1.png";
  13. import img2 from "~/assets/2.png";
  14. import img3 from "~/assets/3.png";
  15. import img4 from "~/assets/4.png";
  16. import img5 from "~/assets/5.png";
  17. import img6 from "~/assets/6.png";
  18. let imageList = $ref([img1, img2, img3, img4, img5, img6]);
  19. const router = useRouter()
  20. function onClickLeft() {
  21. router.back()
  22. }
  23. const swipeRef = ref();
  24. function handleNext(el){
  25. if(el!==5){
  26. swipeRef.value?.next();
  27. }else{
  28. router.push({ name: 'caiji-sy-read' })
  29. }
  30. }
  31. function handleChange(index){
  32. if(index===0){
  33. router.push({ name: 'caiji-sy-read' })
  34. // swipeRef.value?.swipeTo(5);
  35. }
  36. }
  37. </script>