(component): update

This commit is contained in:
就眠儀式 2022-10-15 14:51:57 +08:00
parent 20d26a6063
commit 4a0169e011

View File

@ -6,29 +6,19 @@ export default {
<script setup lang="ts">
import "./index.less";
import {
withDefaults,
provide,
useSlots,
ref,
computed,
VNode,
Ref,
Component,
watch,
} from "vue";
import { withDefaults, provide, useSlots, ref, computed, VNode, Ref, Component, watch } from "vue";
import CarouselItem from "../carouselItem/index.vue";
export interface CarouselProps {
width?: string;
height?: string;
modelValue: string;
anim?: string;
autoplay?: boolean;
arrow?: string;
interval?: number;
indicator?: string;
arrow?: 'always' | 'hover' | 'none';
anim?: 'default' | 'updown' | 'fade';
indicator?: 'inside' | 'outside' | 'none';
pauseOnHover?: boolean;
interval?: number;
}
const props = withDefaults(defineProps<CarouselProps>(), {
@ -86,10 +76,6 @@ watch(
{ immediate: true, deep: true }
);
provide("active", active);
provide("slotsChange", slotsChange);
provide("anim", anim);
const sub = () => {
for (var i = 0; i < childrens.value.length; i++) {
if (childrens.value[i].props?.id === active.value) {
@ -159,6 +145,10 @@ watch(
},
{ immediate: true }
);
provide("active", active);
provide("slotsChange", slotsChange);
provide("anim", anim);
</script>
<template>