vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.17k stars 923 forks source link

feat(client): add VPLink and RouterLink #1353

Closed Mister-Hope closed 7 months ago

Mister-Hope commented 1 year ago

@vuepress/client

two replacement for <RouterLink> in vue-router:

@vuepress/markdown

@vuepress/shared

Documentation

All related api docs update

Performance

( under 6x slowdown mocking withofficial docs)

Original:

Before:

image

After:

image

Adding 1000 pages on official docs:


  // all pages have been loaded after initialization
  onInitialized: async (app) => {
    for (let i = 1; i < 1000; i++) {
      const homepage = await createPage(app, {
        path: `/${i}`,
        // set frontmatter
        frontmatter: {
          layout: 'Layout',
        },
        // set markdown content
        content: `\
# Welcome to ${app.options.title}

This is page ${i}
`,
      })
      // add it to `app.pages`
      app.pages.push(homepage)
    }
  },

Before: image

image

After: image

image

meteorlxy commented 1 year ago

So the new <RouterLink> is not actually in use, right?

Is it possible to get rid of both new and old <RouterLink>? If so, I think it's better to use <VPLink> to replace the <RouterLink> totally.

My concern is to reduce user's confusion about the three different link components.

Mister-Hope commented 1 year ago

Screenshot_2023-07-04-11-00-06-08_320a9a695de7cdce83ed5281148d6f19.jpg

Mister-Hope commented 1 year ago

I think we can stop providing the official router-link and use ours instead. But that could be a breaking change.

The router link component should be kept as we do care about active state and the exact href location sometimes.

With this, users should import the real routerlink and overide ours if they do want the official one