|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <swiper :circular="false" @change="onChangeTab" :current="data.current"
|
|
|
+ <swiper :circular="false" @change="onChangeTab" :current="data.current" :duration="data.duration"
|
|
|
:style="{'height': swiperHeight + 'px'}">
|
|
|
<swiper-item v-for="(cItem,index) in props.list" :key="cItem">
|
|
|
<view class="item flex-col flex-center">
|
|
@@ -14,7 +14,8 @@
|
|
|
ref,
|
|
|
reactive,
|
|
|
watch,
|
|
|
- onMounted
|
|
|
+ onMounted,
|
|
|
+ nextTick
|
|
|
} from 'vue';
|
|
|
import {
|
|
|
onLoad,
|
|
@@ -39,9 +40,14 @@
|
|
|
const emits = defineEmits(['change'])
|
|
|
const data = reactive({
|
|
|
current:0,
|
|
|
+ duration: 500
|
|
|
})
|
|
|
|
|
|
- watch(() => props.positionIndex, (val) => positionData(), {
|
|
|
+ watch(() => props.positionIndex, (val) => {
|
|
|
+ data.duration = 0
|
|
|
+ data.current = props.positionIndex
|
|
|
+ positionData()
|
|
|
+ }, {
|
|
|
immediate: true
|
|
|
})
|
|
|
watch(() => props.list, (val) => positionData(), {
|
|
@@ -59,6 +65,9 @@
|
|
|
if (props.list[data.current-1]) {
|
|
|
props.list[data.current-1].mta_show = true;
|
|
|
}
|
|
|
+ nextTick(() => {
|
|
|
+ data.duration = 500;
|
|
|
+ })
|
|
|
}
|
|
|
function onChangeTab(e) {
|
|
|
data.current = e.detail.current;
|