mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-07-06 16:21:17 +08:00
Compare commits
2 Commits
9a36bfd369
...
f98702e7c0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f98702e7c0 | ||
|
|
d80dc69c0e |
81
index.html
81
index.html
@ -23,9 +23,90 @@
|
||||
|
||||
<!-- 加载基础框架模块 -->
|
||||
<script type="module" src="static/app.js"></script>
|
||||
|
||||
<style>
|
||||
@keyframes shadow {
|
||||
0%,
|
||||
100% {
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
17% {
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
25% {
|
||||
transform: translateY(9px) rotate(22.5deg);
|
||||
}
|
||||
50% {
|
||||
border-bottom-right-radius: 40px;
|
||||
transform: translateY(18px) scale(1, 0.9) rotate(45deg);
|
||||
}
|
||||
75% {
|
||||
transform: translateY(9px) rotate(67.5deg);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0) rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.think-page-loader {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1999;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
background-color: #EFEFEF;
|
||||
}
|
||||
|
||||
.think-page-loader .loader {
|
||||
top: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin: -35px 0 0 -35px;
|
||||
z-index: 999999;
|
||||
display: inline-block;
|
||||
position: fixed;
|
||||
background-color: #EFEFEF;
|
||||
}
|
||||
|
||||
.think-page-loader .loader:before {
|
||||
top: 59px;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
height: 7px;
|
||||
opacity: 0.1;
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background-color: #000;
|
||||
animation: shadow .5s linear infinite;
|
||||
}
|
||||
|
||||
.think-page-loader .loader:after {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-radius: 3px;
|
||||
background-color: #5FB878;
|
||||
animation: loading .5s linear infinite;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="think-page-loader">
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
<router-view></router-view>
|
||||
</body>
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/*! 项目应用根路径 */
|
||||
window.appRoot = (function (script) {
|
||||
return '/' + script.src.split('/').slice(3, -2).join('/') + '/';
|
||||
})(document.querySelector('script[type=module][src*="app.js"]'));
|
||||
})(document.querySelector('script[src*="app.js"]'));
|
||||
|
||||
/*! 模块加载请求处理 */
|
||||
const options = {
|
||||
@ -31,7 +31,6 @@
|
||||
|
||||
const {loadModule} = window['vue3-sfc-loader'];
|
||||
const loadVue = (vuePath) => loadModule(vuePath, options);
|
||||
// const loadVueFile = (vuePath) => () => loadVue(vuePath);
|
||||
|
||||
const router = VueRouter.createRouter({
|
||||
routes: [], history: VueRouter.createWebHashHistory(),
|
||||
@ -41,9 +40,7 @@
|
||||
router.addRoute({
|
||||
name: 'layout', path: '/', component: () => {
|
||||
return loadVue('/static/template/layout.vue');
|
||||
}, children: [
|
||||
{path: '/', redirect: '/static/template/login.vue'},
|
||||
]
|
||||
}, children: [{path: '/', redirect: '/static/template/login.vue'},]
|
||||
});
|
||||
|
||||
// 动态注销路由
|
||||
@ -51,6 +48,9 @@
|
||||
let name = to.fullPath.replace(/[.\/]+/g, '_');
|
||||
if (router.hasRoute(name)) router.removeRoute(name)
|
||||
if (loading) loading = loading.close(), null;
|
||||
document.querySelectorAll('.think-page-loader').forEach(function (el) {
|
||||
el.style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
// 动态注册路由
|
||||
@ -58,7 +58,7 @@
|
||||
router.beforeEach(function (to, fr, next) {
|
||||
let name = to.fullPath.replace(/[.\/]+/g, '_');
|
||||
if (router.hasRoute(name)) {
|
||||
console.log('loadPage', to.fullPath)
|
||||
console.log('PAGE-LOADING:', to.fullPath)
|
||||
loading = ElementPlus.ElLoading.service({
|
||||
lock: true, text: 'Loading', background: 'rgba(0, 0, 0, 0.3)',
|
||||
});
|
||||
@ -67,7 +67,7 @@
|
||||
// 删除页面缓存
|
||||
delete options.moduleCache[to.fullPath];
|
||||
// 登录页面处理
|
||||
if (to.fullPath === '/static/template/login.vue') {
|
||||
if (to.fullPath.indexOf('/login.vue') > -1) {
|
||||
router.addRoute({name: name, path: to.fullPath, component: () => loadVue(to.fullPath)})
|
||||
} else {
|
||||
// 动态注册路由并触发新路由
|
||||
@ -92,8 +92,7 @@
|
||||
document.addEventListener('click', function (event) {
|
||||
event.path.some(function (ele) {
|
||||
if (ele.dataset && ele.dataset.route) {
|
||||
router.push(ele.dataset.route);
|
||||
return true;
|
||||
return router.push(ele.dataset.route);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user