docsearch icon indicating copy to clipboard operation
docsearch copied to clipboard

v3 Configuration problems

Open RayShineHub opened this issue 1 year ago • 6 comments

How do I need to configure to jump to the local station?

At present, my link is like this

my

It always refreshes the page again

But I want to be like your document, like this

your

RayShineHub avatar Jul 18 '22 15:07 RayShineHub

In fact, I want you to keep mouse click events, such as V2's handleselect(),which can customize the jump logic of the page

RayShineHub avatar Jul 21 '22 04:07 RayShineHub

How do I need to configure to jump to the local station?

The extracted element (in the Crawler config) needs to be related or close enough (parent, sibling, children) to the anchor: e.g. here the vuepress-v3-template anchor is a children of h2, which is the element we index.

shortcuts avatar Jul 21 '22 07:07 shortcuts

hello @shortcuts

Searching in an article can realize the jump of the anchor point in the page, but when you click from the home page to the anchor point of searching an article, the website will be reloaded, which will cause some global components to be reloaded.

Can you use handleselect() to intercept the click event and jump the page through the Router , as in docSearch V2?

like this:

handleSelected: (input, event, suggestion) => {
  const { pathname, hash } = new URL(suggestion.url)
  instance.$router.push(`${pathname}${hash}`)
}

How do I need to configure to jump to the local station?

The extracted element (in the Crawler config) needs to be related or close enough (parent, sibling, children) to the anchor: e.g. here the vuepress-v3-template anchor is a children of h2, which is the element we index.

RayShineHub avatar Jul 27 '22 12:07 RayShineHub

but when you click from the home page to the anchor point of searching an article, the website will be reloaded, which will cause some global components to be reloaded.

Ah yes it make sense, but there is indeed no click handler exposed on DocSearch v3. As a workaround, you can import the DocSearch component and add you own logic here

shortcuts avatar Jul 27 '22 15:07 shortcuts

Ah yes it make sense, but there is indeed no click handler exposed on DocSearch v3. As a workaround, you can import the DocSearch component and add you own logic here

Ah, but my website is based on Vue. If the import component changes a lot, I hope DocSearch V3 can expose click handler exposed. Like V2, I believe it is beneficial to many players!

What do you think?

RayShineHub avatar Jul 27 '22 16:07 RayShineHub

hello @shortcuts Can you write an example of a custom hitcomponent component based on vue 3

RayShineHub avatar Aug 03 '22 17:08 RayShineHub