fix: scroll not working
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
This commit is contained in:
parent
d16428002d
commit
696ece1c5b
1 changed files with 9 additions and 5 deletions
|
|
@ -25,13 +25,13 @@ const md = new MarkdownIt()
|
|||
.use(mditHighlight, { hljs })
|
||||
.use(mditFigureWithPCaption, { figcaption: 'alt' });
|
||||
|
||||
const wrapper = ref<HTMLDivElement>();
|
||||
const category = ref('');
|
||||
const page = ref('');
|
||||
const content = ref('');
|
||||
const contentParsed = ref<ReturnType<typeof md.parse>>();
|
||||
const active = ref('');
|
||||
const toc = ref(true);
|
||||
const ts = ref(Date.now());
|
||||
|
||||
onMounted(async () => {
|
||||
if (typeof ROUTE.params['category'] === 'string') {
|
||||
|
|
@ -93,19 +93,23 @@ async function scrollTo(id: string) {
|
|||
await nextTick(() => {
|
||||
if (window.innerWidth < 1024) toc.value = false;
|
||||
});
|
||||
if (pos)
|
||||
window.scrollTo({
|
||||
if (pos) {
|
||||
wrapper.value?.scrollTo({
|
||||
top: pos,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="row full-height q-gutter-sm">
|
||||
<section v-if="content" class="markdown col scroll full-height rounded">
|
||||
<section
|
||||
ref="wrapper"
|
||||
v-if="content"
|
||||
class="markdown col scroll full-height rounded"
|
||||
>
|
||||
<div
|
||||
:key="ts"
|
||||
style="
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue