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