From 153afba1ff32846aa67bd1ca249aa56bad665550 Mon Sep 17 00:00:00 2001 From: Fatpandac Date: Fri, 5 Aug 2022 15:12:08 +0800 Subject: [PATCH] fix(docs): fix badge component (#2238) --- site/docs/.vuepress/client.js | 13 +- site/docs/.vuepress/config.js | 1 - site/docs/.vuepress/styles/index.scss | 1 + .../docs/.vuepress/theme/components/Badge.vue | 14 +- .../.vuepress/theme/components/RightMenu.vue | 2 +- site/package-lock.json | 11 + site/package.json | 1 + site/yarn.lock | 2189 +++++++++-------- 8 files changed, 1238 insertions(+), 994 deletions(-) diff --git a/site/docs/.vuepress/client.js b/site/docs/.vuepress/client.js index 56feb6261..3757a9c46 100644 --- a/site/docs/.vuepress/client.js +++ b/site/docs/.vuepress/client.js @@ -1,7 +1,9 @@ -import { defineClientConfig } from "@vuepress/client"; -import { usePageData } from "@vuepress/client"; import oldContributorsData from "./oldContributorsData.json"; +import { usePageData } from "@vuepress/client"; +import { defineClientConfig } from "@vuepress/client"; +import CountTo from "vue-count-to/src/vue-countTo.vue"; + const addOldDocsContributors = () => { const page = usePageData(); if (!page.value.git) return; @@ -33,13 +35,18 @@ const addOldDocsContributors = () => { }; export default defineClientConfig({ - enhance({ router }) { + enhance({ router, app }) { + // register global components + app.component("CountTo", CountTo); + + // add old docs contributors router.afterEach((to, from) => { if (to.fullPath !== from.fullPath) { addOldDocsContributors(); } }); + // baidu analytics router.beforeEach((to, from, next) => { if (typeof _hmt != "undefined") { if (to.path && to.fullPath !== from.fullPath) { diff --git a/site/docs/.vuepress/config.js b/site/docs/.vuepress/config.js index a7f467770..e40adb331 100644 --- a/site/docs/.vuepress/config.js +++ b/site/docs/.vuepress/config.js @@ -113,7 +113,6 @@ module.exports = { }), activeHeaderLinksPlugin({ headerLinkSelector: "div.right-menu-item > a", - delay: 0, }), docsearchPlugin({ apiKey: "30c521836bfc8e97915576e11ac2cebc", diff --git a/site/docs/.vuepress/styles/index.scss b/site/docs/.vuepress/styles/index.scss index 4a7f6b74e..10c633dc5 100644 --- a/site/docs/.vuepress/styles/index.scss +++ b/site/docs/.vuepress/styles/index.scss @@ -1,5 +1,6 @@ :root { --sidebar-width: 17rem; + scroll-behavior: smooth; } .site-name.can-hide { diff --git a/site/docs/.vuepress/theme/components/Badge.vue b/site/docs/.vuepress/theme/components/Badge.vue index b5b261170..9ed37462a 100644 --- a/site/docs/.vuepress/theme/components/Badge.vue +++ b/site/docs/.vuepress/theme/components/Badge.vue @@ -2,13 +2,12 @@   - {{ number }} + -