<script setup lang="ts">
import { ref } from 'vue'
const activeIndex = ref(0)
// 当 swiper 下标发生变化时触发
// UniHelper返回小程序组件的类型。这里例swiper的change事件类型
const onChange: UniHelper.SwiperOnChange = (ev) => {
console.log(ev.detail.current, '333')
// !非空断言,排除空值情况
activeIndex.value = ev.detail!.current
}
</script>
<template>
<view>
<swiper :circular="true" :autoplay="false" :interval="3000" @change="onChange">
<!-- ........ -->
</swiper>
</template>
Uni-helper插件的使用-类型推断
于 2024-01-22 16:46:04 首次发布