diff --git a/web/src/pages/Edit/components/Outline.vue b/web/src/pages/Edit/components/Outline.vue index 0b24cb43..ca7e119c 100644 --- a/web/src/pages/Edit/components/Outline.vue +++ b/web/src/pages/Edit/components/Outline.vue @@ -1,22 +1,32 @@ @@ -35,7 +35,6 @@ export default { isOutlineEdit(val) { if (val) { this.$nextTick(() => { - this.$refs.outline.refresh() document.body.appendChild(this.$refs.outlineEditContainer) }) } @@ -46,6 +45,16 @@ export default { onClose() { this.setIsOutlineEdit(false) + }, + + onScrollTo(y) { + let container = this.$refs.outlineEditContainer + let height = container.offsetHeight + let top = container.scrollTop + y += 50 + if (y > top + height) { + container.scrollTo(0, y - height / 2) + } } } } @@ -63,7 +72,6 @@ export default { justify-content: center; background-color: #fff; overflow-y: auto; - padding: 50px 0; .closeBtn { position: absolute; @@ -80,6 +88,7 @@ export default { width: 1000px; height: max-content; overflow: hidden; + padding: 50px 0; /deep/ .customNode { .nodeEdit { diff --git a/web/src/pages/Edit/components/OutlineSidebar.vue b/web/src/pages/Edit/components/OutlineSidebar.vue index 1414d702..bf482657 100644 --- a/web/src/pages/Edit/components/OutlineSidebar.vue +++ b/web/src/pages/Edit/components/OutlineSidebar.vue @@ -3,7 +3,11 @@
- + @@ -37,10 +41,20 @@ export default { } }, methods: { - ...mapMutations(['setIsOutlineEdit']), + ...mapMutations(['setIsOutlineEdit', 'setActiveSidebar']), onChangeToOutlineEdit() { + this.setActiveSidebar('') this.setIsOutlineEdit(true) + }, + + onScrollTo(y) { + let container = this.$refs.sidebar.getEl() + let height = container.offsetHeight + let top = container.scrollTop + if (y > top + height) { + container.scrollTo(0, y - height / 2) + } } } } diff --git a/web/src/pages/Edit/components/Sidebar.vue b/web/src/pages/Edit/components/Sidebar.vue index d82b5153..377a93c0 100644 --- a/web/src/pages/Edit/components/Sidebar.vue +++ b/web/src/pages/Edit/components/Sidebar.vue @@ -9,7 +9,7 @@
{{ title }}
-
+
@@ -59,6 +59,10 @@ export default { close() { this.show = false this.setActiveSidebar('') + }, + + getEl() { + return this.$refs.sidebarContent } } }