🐛(carousel): 修复轮播图初始化时无法获取 item 列表

更新文档
This commit is contained in:
就眠儀式
2022-06-18 16:33:31 +08:00
parent f030784410
commit f446f4ebd7
5 changed files with 44 additions and 17 deletions

View File

@@ -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) {