refactor: use setup refactor

This commit is contained in:
xiaoxian521
2021-09-19 01:12:46 +08:00
parent 85f4917f26
commit afff1d677b
18 changed files with 128 additions and 106 deletions

View File

@@ -10,7 +10,6 @@ class algorithmProxy implements ProxyAlgorithm {
return Object.keys(val)
.map(v => {
return {
// @ts-ignore
...val[v],
key: v
};

View File

@@ -5,7 +5,8 @@ import { excludeProps } from "./utils";
*/
export const defaultConfig: AxiosRequestConfig = {
baseURL: "",
timeout: 10000, //10秒超时
//10秒超时
timeout: 10000,
headers: {
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json",

View File

@@ -1,8 +1,12 @@
export const hasClass = (ele: Element, cls: string): any => {
export const hasClass = (ele: RefType<any>, cls: string): any => {
return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
};
export const addClass = (ele: Element, cls: string, extracls?: string): any => {
export const addClass = (
ele: RefType<any>,
cls: string,
extracls?: string
): any => {
if (!hasClass(ele, cls)) ele.className += " " + cls;
if (extracls) {
if (!hasClass(ele, extracls)) ele.className += " " + extracls;
@@ -10,7 +14,7 @@ export const addClass = (ele: Element, cls: string, extracls?: string): any => {
};
export const removeClass = (
ele: Element,
ele: RefType<any>,
cls: string,
extracls?: string
): any => {

View File

@@ -2,11 +2,16 @@ import NProgress from "nprogress";
import "nprogress/nprogress.css";
NProgress.configure({
easing: "ease", // 动画方式
speed: 500, // 递增进度条的速度
showSpinner: true, // 是否显示加载ico
trickleSpeed: 200, // 自动递增间隔
minimum: 0.3 // 初始化时的最小百分比
// 动画方式
easing: "ease",
// 递增进度条的速度
speed: 500,
// 是否显示加载ico
showSpinner: true,
// 自动递增间隔
trickleSpeed: 200,
// 初始化时的最小百分比
minimum: 0.3
});
export default NProgress;