import { Image, Swiper } from "@queenjs/ui"; import { defineComponent, reactive, ref } from "vue"; import { array, string } from "vue-types"; export default defineComponent({ props: { data: array().isRequired, current: string().isRequired, }, setup(props) { const carouselRef = ref(); const index = props.data.findIndex((d) => d == props.current); const state = reactive({ index: index, }); return () => { const { data } = props; return (
{state.index + 1}/{data.length}
(carouselRef.value = e)} options={{ slidesPerView: 1, initialSlide: state.index, on: { slideChange: (e: any) => { state.index = e.realIndex; }, }, }} > {data?.map((item, index) => (
))}
); }; }, });