Skip to content

Commit eaccee5

Browse files
committed
Test: 测试手机触控支持
1 parent b814c39 commit eaccee5

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"type": "module",
77
"scripts": {
8-
"dev": "vitepress dev",
8+
"dev": "vitepress dev --host",
99
"build": "vitepress build",
1010
"preview": "vitepress preview"
1111
},

package/components/NanoMain/index.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import scrollbarOptions from '../../config/scrollbarOptions';
2929
import { OverlayScrollbarsComponent } from 'overlayscrollbars-vue';
3030
import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
31-
import { useRoute } from 'vitepress';
31+
import { onContentUpdated, useRoute } from 'vitepress';
3232
import emitter from '../../emitter';
3333
3434
const route = useRoute();
@@ -44,7 +44,23 @@
4444
immediate: true
4545
});
4646
47+
function hashChange() {
48+
if (location.hash) {
49+
const _hashText = decodeURIComponent(location.hash.replace('#', ''));
50+
emitter.emit('scroll-to-hash', _hashText);
51+
}
52+
}
53+
54+
onContentUpdated(() => {
55+
setTimeout(() => {
56+
hashChange();
57+
}, 240);
58+
});
59+
4760
onMounted(() => {
61+
setTimeout(() => {
62+
hashChange();
63+
}, 240);
4864
// Listen for scroll-to-hash events
4965
emitter.on('scroll-to-hash', (hash: string) => {
5066
if (hash === '' || hash === null || hash === undefined) {

package/config/horizontalTopScrollBarOptions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// options config: https://github.com/KingSora/OverlayScrollbars
22
export default {
33
scrollbars: {
4-
theme: 'os-theme-x',
5-
touchSupport: true,
6-
autoHide: 'never',
7-
autoHideSuspend: true
4+
theme: 'os-theme-x'
85
},
96
overflow: {
107
x: 'scroll',

package/config/scrollbarOptions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// options config: https://github.com/KingSora/OverlayScrollbars
22
export default {
33
scrollbars: {
4-
theme: 'os-theme-custom',
5-
touchSupport: true,
6-
autoHide: 'never',
7-
autoHideSuspend: true
4+
theme: 'os-theme-custom'
85
}
96
};

0 commit comments

Comments
 (0)