Skip to content

Commit 7e98141

Browse files
committed
bump ver, activate replaceHash demo
1 parent 977c464 commit 7e98141

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

demo/components/Sidebar/TOC.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const { clickType } = inject('DemoRadios') as {
2020
const { activeIndex, activeId, setActive, isActive } = useActive(targets, {
2121
rootId,
2222
overlayHeight,
23+
replaceHash: true,
2324
/* boundaryOffset: {
2425
toBottom: 100,
2526
toTop: -100,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-use-active-scroll",
3-
"version": "0.9.2",
3+
"version": "0.9.4",
44
"private": false,
55
"description": "Reactive and accurate TOC/sidebar links without compromises for Vue 3.",
66
"keywords": [

src/useActive.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export function useActive(
188188

189189
function onHashChange(event: HashChangeEvent) {
190190
if (matchMedia.value) {
191+
// If hash is not in the URL
191192
if (!event.newURL.includes('#') && activeId.value) {
192193
const prevY = getSentinel();
193194

@@ -200,6 +201,7 @@ export function useActive(
200201
});
201202
}
202203

204+
// Else set it as active
203205
const hashId = getHashId();
204206
if (hashId) {
205207
activeId.value = hashId;

0 commit comments

Comments
 (0)