chore: remove NProgress

This commit is contained in:
chansee97 2024-04-01 12:38:30 +08:00
parent a95803867c
commit 6314eaf3d1
8 changed files with 5 additions and 105 deletions

View File

@ -56,7 +56,6 @@
"chroma-js": "^2.4.2", "chroma-js": "^2.4.2",
"echarts": "^5.5.0", "echarts": "^5.5.0",
"md-editor-v3": "^4.11.3", "md-editor-v3": "^4.11.3",
"nprogress": "^0.2.0",
"performant-array-to-tree": "^1.11.0", "performant-array-to-tree": "^1.11.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"pinia-plugin-persist": "^1.0.0", "pinia-plugin-persist": "^1.0.0",
@ -71,7 +70,6 @@
"@iconify/vue": "^4.1.1", "@iconify/vue": "^4.1.1",
"@types/chroma-js": "^2.4.4", "@types/chroma-js": "^2.4.4",
"@types/node": "^20.11.28", "@types/node": "^20.11.28",
"@types/nprogress": "^0.2.3",
"@types/qs": "^6.9.12", "@types/qs": "^6.9.12",
"@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0", "@vitejs/plugin-vue-jsx": "^3.1.0",

View File

@ -42,7 +42,7 @@ const appStore = useAppStore()
.list-enter-from,.list-leave-to { .list-enter-from,.list-leave-to {
opacity: 0; opacity: 0;
transform: translateY(-30px); transform: translateX(-30px);
} }
.list-leave-active { .list-leave-active {

View File

@ -1,11 +0,0 @@
import NProgress from 'nprogress'
import { useAppStore } from '@/store'
export function install() {
// 初始载入初始化body的css变量
const appStore = useAppStore()
appStore.setPrimaryColor(appStore.primaryColor)
NProgress.configure({ easing: 'ease', speed: 500 })
window.$NProgress = NProgress
}

View File

@ -15,8 +15,8 @@ export function setupRouterGuard(router: Router) {
window.open(to.meta.herf) window.open(to.meta.herf)
return false return false
} }
// 开始 NProgress // 开始 loadingBar
appStore.showProgress && window.$NProgress?.start() appStore.showProgress && window.$loadingBar?.start()
// 判断有无TOKEN,登录鉴权 // 判断有无TOKEN,登录鉴权
const isLogin = Boolean(local.get('token')) const isLogin = Boolean(local.get('token'))
@ -67,7 +67,7 @@ export function setupRouterGuard(router: Router) {
router.afterEach((to) => { router.afterEach((to) => {
// 修改网页标题 // 修改网页标题
document.title = `${to.meta.title} - ${title}` document.title = `${to.meta.title} - ${title}`
// 结束 NProgress // 结束 loadingBar
appStore.showProgress && window.$NProgress?.done() appStore.showProgress && window.$loadingBar?.finish()
}) })
} }

View File

@ -67,7 +67,6 @@ export const useAppStore = defineStore('app-store', {
}, },
/* 设置主题色 */ /* 设置主题色 */
setPrimaryColor(color: string) { setPrimaryColor(color: string) {
docEle.value.style.setProperty('--primary-color', color)
const brightenColor = chroma(color).brighten(1).hex() const brightenColor = chroma(color).brighten(1).hex()
const darkenColor = chroma(color).darken(1).hex() const darkenColor = chroma(color).darken(1).hex()
set(this.theme, 'common.primaryColor', color) set(this.theme, 'common.primaryColor', color)

View File

@ -1,6 +1,5 @@
@import './reset.css'; @import './reset.css';
@import './transition.css'; @import './transition.css';
@import './nprogress.css';
html, html,
body, body,

View File

@ -1,84 +0,0 @@
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
}
#nprogress .bar {
background: var(--primary-color);
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 2px;
}
/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px var(--primary-color), 0 0 5px var(--primary-color);
opacity: 1.0;
-webkit-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}
/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}
#nprogress .spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: var(--primary-color);
border-left-color: var(--primary-color);
border-radius: 50%;
-webkit-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}
.nprogress-custom-parent {
overflow: hidden;
position: relative;
}
.nprogress-custom-parent #nprogress .spinner,
.nprogress-custom-parent #nprogress .bar {
position: absolute;
}
@-webkit-keyframes nprogress-spinner {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes nprogress-spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

View File

@ -3,7 +3,6 @@ interface Window {
$dialog: import('naive-ui').DialogApi $dialog: import('naive-ui').DialogApi
$message: import('naive-ui').MessageApi $message: import('naive-ui').MessageApi
$notification: import('naive-ui').NotificationApi $notification: import('naive-ui').NotificationApi
$NProgress: import('NProgress').NProgress
} }
declare const AMap: any declare const AMap: any