feat(frontend_nuxt): wire up nprogress plugin

This commit is contained in:
Tim
2025-08-08 15:05:33 +08:00
parent af9028190d
commit af2cf99041
4 changed files with 56 additions and 0 deletions

View File

@@ -273,4 +273,34 @@ body {
position: relative;
min-width: 0;
}
}
/* NProgress styles */
#nprogress {
pointer-events: none;
}
#nprogress .bar {
background: var(--primary-color);
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 3px;
}
#nprogress .peg {
display: block;
position: absolute;
right: 0;
width: 100px;
height: 100%;
box-shadow: 0 0 10px var(--primary-color), 0 0 5px var(--primary-color);
opacity: 1;
transform: rotate(3deg) translate(0px, -4px);
}
#nprogress .spinner {
display: none;
}

View File

@@ -11,6 +11,7 @@
"highlight.js": "^11.11.1",
"ldrs": "^1.0.0",
"markdown-it": "^14.1.0",
"nprogress": "^0.2.0",
"nuxt": "latest",
"vditor": "^3.11.1",
"vue-easy-lightbox": "^1.19.0",
@@ -6415,6 +6416,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/nprogress": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz",
"integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==",
"license": "MIT"
},
"node_modules/nth-check": {
"version": "2.1.1",
"license": "BSD-2-Clause",

View File

@@ -15,6 +15,7 @@
"ldrs": "^1.0.0",
"markdown-it": "^14.1.0",
"nuxt": "latest",
"nprogress": "^0.2.0",
"vditor": "^3.11.1",
"vue-easy-lightbox": "^1.19.0",
"vue-echarts": "^7.0.3",

View File

@@ -0,0 +1,18 @@
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
export default defineNuxtPlugin((nuxtApp) => {
NProgress.configure({ showSpinner: false })
nuxtApp.hook('page:start', () => {
NProgress.start()
})
nuxtApp.hook('page:finish', () => {
NProgress.done()
})
nuxtApp.hook('page:error', () => {
NProgress.done()
})
})