新的版本
This commit is contained in:
60
src/assets/css/global.less
Normal file
60
src/assets/css/global.less
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -- 全局样式 -- */
|
||||
|
||||
// 变量
|
||||
|
||||
@headerHeight: 4rem;
|
||||
|
||||
@colorPrimary: #409EFF;
|
||||
@colorSecondary: #67C23A;
|
||||
@colorWhite: #F5F5F5;
|
||||
|
||||
// 滚动条
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 1rem;
|
||||
background-color: #F5F5F5;
|
||||
|
||||
&:hover {
|
||||
background-color: @colorPrimary;
|
||||
}
|
||||
}
|
||||
|
||||
// 标签
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
body {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
// 阴影
|
||||
|
||||
.shadow-1 {
|
||||
box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
// 加载中(链接列表)
|
||||
|
||||
.loading-link {
|
||||
background-color: rgba(255, 255, 255, 0.5) !important;
|
||||
backdrop-filter: blur(0.2rem);
|
||||
|
||||
.el-icon-loading {
|
||||
font-size: 2rem !important;
|
||||
}
|
||||
|
||||
.el-loading-text {
|
||||
font-size: 1.5rem !important;
|
||||
}
|
||||
}
|
68
src/assets/js/utils.js
Normal file
68
src/assets/js/utils.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import { Loading } from 'element-ui';
|
||||
|
||||
class Utils {
|
||||
|
||||
constructor() { }
|
||||
|
||||
/**
|
||||
* 初始化链接列表,设置唯一ID
|
||||
*/
|
||||
initNavLinkID() {
|
||||
// 加载中提示
|
||||
var loading = Loading.service({
|
||||
customClass: 'loading-link',
|
||||
lock: true,
|
||||
spinner: 'el-icon-loading',
|
||||
text: '载入中,请稍候'
|
||||
});
|
||||
|
||||
var currentIndex = 0;
|
||||
var currentIndexCpy = 0;
|
||||
|
||||
var fn = (obj) => {
|
||||
currentIndex += 1;
|
||||
obj.id = currentIndex;
|
||||
|
||||
// 有链接,无子路径
|
||||
if (obj.links != undefined && obj.sub === undefined) {
|
||||
obj.sub = [];
|
||||
}
|
||||
|
||||
// 递归
|
||||
if (obj.links != undefined) {
|
||||
obj.links.forEach(item => {
|
||||
// 添加到子路径(适配 Element UI - Tree)
|
||||
obj.sub.push(item);
|
||||
});
|
||||
}
|
||||
|
||||
// 递归
|
||||
if (obj.sub != undefined) {
|
||||
obj.sub.forEach(item => {
|
||||
setTimeout(() => {
|
||||
fn(item);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 检测 currentIndex 是否已停止变化
|
||||
var timer = setInterval(() => {
|
||||
if (currentIndex == currentIndexCpy) {
|
||||
clearInterval(timer);
|
||||
// 加载中提示
|
||||
loading.close();
|
||||
}
|
||||
|
||||
// 同步
|
||||
currentIndexCpy = currentIndex;
|
||||
}, 1000);
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const utils = new Utils;
|
||||
|
||||
export default utils;
|
Reference in New Issue
Block a user