diff --git a/src/components/model-custom/components/top-side-operation/index.vue b/src/components/model-custom/components/top-side-operation/index.vue index 8d69a4f3..1db9bb47 100644 --- a/src/components/model-custom/components/top-side-operation/index.vue +++ b/src/components/model-custom/components/top-side-operation/index.vue @@ -15,7 +15,7 @@
-
+
{{ item.name }}
@@ -65,16 +65,18 @@ watchEffect(() => { history_list.value = dataSourceStore.custom_group_records; records_index.value = dataSourceStore.custom_group_records_index; } - // 获取当前选中的内容 --中间区域的滚动效果 - const activeCard: HTMLElement | null = document.querySelector(`.history-dialog-item.active.${props.configType}`); - if (activeCard) { - // 获取选中内容的位置 - const scrollY = activeCard.offsetTop; - if (historyDialog.value) { - // 选中的滚动到指定位置 - historyDialog.value.scrollTo({ top: scrollY - 100, behavior: 'smooth' }); + nextTick(() => { + // 获取当前选中的内容 --中间区域的滚动效果 + const activeCard: HTMLElement | null = document.querySelector(`.history-dialog-item.active.${props.configType}`); + if (activeCard) { + // 获取选中内容的位置 + const scrollY = activeCard.offsetTop; + if (historyDialog.value) { + // 选中的滚动到指定位置 + historyDialog.value.scrollTo({ top: scrollY - 100, behavior: 'smooth' }); + } } - } + }); }); const emits = defineEmits(['back', 'forward', 'handleHistory']);