@sugarat/theme 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
v-if="show"
|
|
5
5
|
id="giscus-comment"
|
|
6
6
|
data-pagefind-ignore="all"
|
|
7
|
+
ref="commentEl"
|
|
7
8
|
>
|
|
8
9
|
<el-affix
|
|
9
|
-
:class="{ hidden:
|
|
10
|
+
:class="{ hidden: commentIsVisible }"
|
|
10
11
|
class="comment-btn"
|
|
11
12
|
target="main"
|
|
12
13
|
position="bottom"
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
</div>
|
|
44
45
|
</template>
|
|
45
46
|
<script setup lang="ts">
|
|
46
|
-
import { useDark } from '@vueuse/core'
|
|
47
|
+
import { useDark, useElementVisibility } from '@vueuse/core'
|
|
47
48
|
import { useData, useRoute } from 'vitepress'
|
|
48
49
|
import { computed, ref, watch } from 'vue'
|
|
49
50
|
import { ElAffix, ElButton } from 'element-plus'
|
|
@@ -52,10 +53,9 @@ import { useGiscusConfig } from '../composables/config/blog'
|
|
|
52
53
|
import { Theme } from '../composables/config/index'
|
|
53
54
|
|
|
54
55
|
const { frontmatter } = useData()
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
}
|
|
56
|
+
const commentEl = ref(null)
|
|
57
|
+
const commentIsVisible = useElementVisibility(commentEl)
|
|
58
|
+
|
|
59
59
|
const handleScrollToComment = () => {
|
|
60
60
|
document.querySelector('#giscus-comment')?.scrollIntoView({
|
|
61
61
|
behavior: 'smooth',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useData, useRoute } from 'vitepress'
|
|
1
|
+
import { useData, useRoute, withBase } from 'vitepress'
|
|
2
2
|
import {
|
|
3
3
|
Component,
|
|
4
4
|
computed,
|
|
@@ -85,7 +85,7 @@ export function useCurrentArticle() {
|
|
|
85
85
|
const currentPath = route.path.replace(/.html$/, '')
|
|
86
86
|
return docs.value?.find((v) =>
|
|
87
87
|
// 兼容中文路径
|
|
88
|
-
[currentPath, decodeURIComponent(currentPath)].includes(v.route)
|
|
88
|
+
[currentPath, decodeURIComponent(currentPath)].includes(withBase(v.route))
|
|
89
89
|
)
|
|
90
90
|
})
|
|
91
91
|
|