🐛(carousel): 修复轮播图初始化时无法获取 item 列表
更新文档
This commit is contained in:
parent
f030784410
commit
f446f4ebd7
@ -75,10 +75,9 @@ const setItemInstanceBySlot = function (nodeList: VNode[]) {
|
||||
};
|
||||
|
||||
watch(slotsChange, () => {
|
||||
alert("111111111111");
|
||||
childrens.value = [];
|
||||
setItemInstanceBySlot((slot.default && slot.default()) as VNode[]);
|
||||
});
|
||||
}, { immediate: true });
|
||||
|
||||
provide("active", active);
|
||||
provide("slotsChange", slotsChange);
|
||||
@ -96,7 +95,6 @@ const sub = function () {
|
||||
}
|
||||
};
|
||||
|
||||
// 下一页
|
||||
const add = function () {
|
||||
for (var i = 0; i < childrens.value.length; i++) {
|
||||
if (childrens.value[i].props?.id === active.value) {
|
||||
@ -110,7 +108,6 @@ const add = function () {
|
||||
}
|
||||
};
|
||||
|
||||
// 自动播放
|
||||
const autoplay = () => {
|
||||
for (var i = 0; i < childrens.value.length; i++) {
|
||||
if (childrens.value[i].props?.id === active.value) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { computed, VNodeTypes } from 'vue';
|
||||
import { computed, VNodeTypes } from "vue";
|
||||
export default {
|
||||
name: "Iframe",
|
||||
};
|
||||
@ -13,9 +13,8 @@ export interface IframeProps {
|
||||
const props = defineProps<IframeProps>();
|
||||
|
||||
const src = computed(() => {
|
||||
return props.src as string
|
||||
})
|
||||
|
||||
return props.src as string;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -10,8 +10,31 @@ import Iframe from "./Iframe.vue";
|
||||
import Title from "./Title.vue";
|
||||
import CloseBtn from "./CloseBtn.vue";
|
||||
import Resize from "./Resize.vue";
|
||||
import { Ref, ref, watch, computed, useSlots, VNodeTypes, nextTick, inject } from "vue";
|
||||
import { nextId, maxArea, maxOffset, getArea, calculateArea, calculateOffset, calculateContent, calculateType, minArea, minOffset, updateMinArrays, getDrawerAnimationClass, calculateDrawerArea } from "../utils";
|
||||
import {
|
||||
Ref,
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
useSlots,
|
||||
VNodeTypes,
|
||||
nextTick,
|
||||
inject,
|
||||
} from "vue";
|
||||
import {
|
||||
nextId,
|
||||
maxArea,
|
||||
maxOffset,
|
||||
getArea,
|
||||
calculateArea,
|
||||
calculateOffset,
|
||||
calculateContent,
|
||||
calculateType,
|
||||
minArea,
|
||||
minOffset,
|
||||
updateMinArrays,
|
||||
getDrawerAnimationClass,
|
||||
calculateDrawerArea,
|
||||
} from "../utils";
|
||||
import useMove from "../composable/useMove";
|
||||
import useResize from "../composable/useResize";
|
||||
import { zIndexKey } from "../tokens";
|
||||
@ -53,7 +76,7 @@ export interface LayModalProps {
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<LayModalProps>(), {
|
||||
domId: '',
|
||||
domId: "",
|
||||
title: "标题",
|
||||
setTop: false,
|
||||
offset: () => ["50%", "50%"],
|
||||
@ -89,10 +112,18 @@ const min: Ref<boolean> = ref(false);
|
||||
const id: Ref<string> = ref(nextId());
|
||||
const layero = ref<HTMLElement | null>(null);
|
||||
const type: number = calculateType(props.type);
|
||||
const area: Ref<string[]> = ref(calculateArea(props.type, props.area, props.offset));
|
||||
const offset: Ref<string[]> = ref(calculateOffset(props.offset, area.value, props.type));
|
||||
const contentHeight = ref(calculateContent(area.value[1], props.btn, type, props.isMessage));
|
||||
const index: Ref<number | Function> = ref(props.zIndex ?? inject(zIndexKey, 99999));
|
||||
const area: Ref<string[]> = ref(
|
||||
calculateArea(props.type, props.area, props.offset)
|
||||
);
|
||||
const offset: Ref<string[]> = ref(
|
||||
calculateOffset(props.offset, area.value, props.type)
|
||||
);
|
||||
const contentHeight = ref(
|
||||
calculateContent(area.value[1], props.btn, type, props.isMessage)
|
||||
);
|
||||
const index: Ref<number | Function> = ref(
|
||||
props.zIndex ?? inject(zIndexKey, 99999)
|
||||
);
|
||||
const visible: Ref<boolean> = ref(false);
|
||||
const first: Ref<boolean> = ref(true);
|
||||
|
||||
|
@ -1 +1 @@
|
||||
export const zIndexKey = Symbol("zIndex");
|
||||
export const zIndexKey = Symbol("zIndex");
|
||||
|
@ -1,3 +1,3 @@
|
||||
export type StringObject = Record<string, unknown>;
|
||||
|
||||
export interface InstallOptions extends StringObject {}
|
||||
export interface InstallOptions extends StringObject {}
|
||||
|
Loading…
Reference in New Issue
Block a user