TA的每日心情 | 衰 2024-1-4 15:08 |
---|
签到天数: 18 天 [LV.4]偶尔看看III
注册会员
- 积分
- 159
|
- <script setup lang="ts">
- let Compoennt1 = {},
- Compoennt2 = {},
- Compoennt3 = {},
- Compoennt4 = {},
- Compoennt5 = {};
- const onSlideChange = () => {
- const activeIndex = mySwiper.value.activeIndex;
- currIndex.value = activeIndex;
- if (activeIndex == 1) {
- Compoennt1 = defineAsyncComponent(() => import("../components/Compoennt1.vue"), true);
- }
- if (activeIndex == 2) {
- Compoennt2 = defineAsyncComponent(() => import("../components/Compoennt2.vue"));
- }
- if (activeIndex == 3) {
- Compoennt3 = defineAsyncComponent(() => import("../components/Compoennt3.vue"));
- }
- if (activeIndex == 4) {
- Compoennt4 = defineAsyncComponent(() => import("../components/Compoennt4.vue"));
- }
- if (activeIndex == 5) {
- Compoennt5 = defineAsyncComponent(() => import("../components/Compoennt5.vue"));
- }
- };
- </script>
- <template>
- <swiper
- @swiper="onSwiper"
- autoHieght
- @slideChange="onSlideChange"
- class="home-swiper"
- direction="vertical"
- :speed="500"
- :touchRatio="2"
- :resistanceRatio="0.9"
- >
- <swiper-slide>
- <Component1 />
- </swiper-slide>
- <swiper-slide >
- <Component2 />
- </swiper-slide>
- <swiper-slide >
- <Component3 />
- </swiper-slide>
- <swiper-slide >
- <Component4 />
- </swiper-slide>
- <swiper-slide>
- <Compoennt5 />
- </swiper-slide>
- </swiper>
- </template>
复制代码
|
|