Skip to content

Commit a7b1f68

Browse files
committed
feat: added nprogress
1 parent 10ae1f6 commit a7b1f68

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nginx-ui-frontend-next",
33
"private": true,
4-
"version": "1.7.2",
4+
"version": "1.7.3",
55
"type": "commonjs",
66
"scripts": {
77
"dev": "vite",
@@ -14,12 +14,14 @@
1414
"@ant-design/icons-vue": "^6.1.0",
1515
"@types/lodash": "^4.14.188",
1616
"@types/marked": "^4.0.8",
17+
"@types/nprogress": "^0.2.0",
1718
"@types/sortablejs": "^1.15.0",
1819
"ant-design-vue": "^3.2.15",
1920
"apexcharts": "^3.36.3",
2021
"axios": "^1.2.2",
2122
"dayjs": "^1.11.7",
2223
"marked": "^4.2.5",
24+
"nprogress": "^0.2.0",
2325
"pinia": "^2.0.28",
2426
"pinia-plugin-persistedstate": "^3.0.2",
2527
"reconnecting-websocket": "^4.4.0",

frontend/src/routes/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
SettingOutlined,
1414
SafetyCertificateOutlined
1515
} from '@ant-design/icons-vue'
16+
import NProgress from 'nprogress'
17+
import 'nprogress/nprogress.css'
1618

1719
const {$gettext} = gettext
1820

@@ -174,10 +176,14 @@ const router = createRouter({
174176
routes: routes
175177
})
176178

179+
NProgress.configure({showSpinner: false})
180+
177181
router.beforeEach((to, from, next) => {
178182
// @ts-ignore
179183
document.title = to.name?.() + ' | Nginx UI'
180184

185+
NProgress.start()
186+
181187
const user = useUserStore()
182188
const {is_login} = user
183189

@@ -189,4 +195,8 @@ router.beforeEach((to, from, next) => {
189195

190196
})
191197

198+
router.afterEach(() => {
199+
NProgress.done()
200+
})
201+
192202
export default router

0 commit comments

Comments
 (0)