mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-11 17:00:41 +08:00
Merge pull request #5442 from aignatov-bio/ai-sci-8491-fix-scrolling-position-in-navigator
Fix scrolling position in navigator [SCI-8491]
This commit is contained in:
commit
c86ba663e1
1 changed files with 7 additions and 3 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<i @click="$emit('navigator:colapse')" class="sn-icon sn-icon-close ml-auto cursor-pointer absolute right-3 top-2"></i>
|
<i @click="$emit('navigator:colapse')" class="sn-icon sn-icon-close ml-auto cursor-pointer absolute right-3 top-2"></i>
|
||||||
</div>
|
</div>
|
||||||
<perfect-scrollbar class="grow py-4 relative px-3">
|
<perfect-scrollbar @ps-scroll-y="onScroll" ref="scrollContainer" class="grow py-4 relative px-3">
|
||||||
<NavigatorItem v-for="item in sortedMenuItems"
|
<NavigatorItem v-for="item in sortedMenuItems"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:currentItemId="currentItemId"
|
:currentItemId="currentItemId"
|
||||||
|
|
@ -34,6 +34,7 @@ export default {
|
||||||
menuItems: [],
|
menuItems: [],
|
||||||
navigatorCollapsed: false,
|
navigatorCollapsed: false,
|
||||||
navigatorUrl: null,
|
navigatorUrl: null,
|
||||||
|
navigatorYScroll: 0,
|
||||||
currentItemId: null,
|
currentItemId: null,
|
||||||
archived: null
|
archived: null
|
||||||
}
|
}
|
||||||
|
|
@ -57,8 +58,8 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.changePage();
|
this.changePage();
|
||||||
|
|
||||||
$(document).on('turbolinks:load', () => {
|
$(document).on('turbolinks:load', () => {
|
||||||
|
this.$refs.scrollContainer.$el.scrollTop = this.navigatorYScroll;
|
||||||
this.changePage();
|
this.changePage();
|
||||||
if ($(`[navigator-item-id="${this.currentItemId}"]`).length === 0) {
|
if ($(`[navigator-item-id="${this.currentItemId}"]`).length === 0) {
|
||||||
this.loadTree();
|
this.loadTree();
|
||||||
|
|
@ -93,7 +94,10 @@ export default {
|
||||||
this.menuItems = data.items;
|
this.menuItems = data.items;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
onScroll({target}) {
|
||||||
|
this.navigatorYScroll = target.scrollTop;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue