Swiper中文论坛
标题:
移动端整屏滑动很卡,一点都不丝滑怎么办
[打印本页]
作者:
bujiatang
时间:
2023-9-7 14:43
标题:
移动端整屏滑动很卡,一点都不丝滑怎么办
<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>
复制代码
欢迎光临 Swiper中文论坛 (http://bbs.swiper.com.cn/)
Powered by Discuz! X3.2