修改样式细节,修改utils

This commit is contained in:
MTrun
2021-12-14 16:41:43 +08:00
parent 7e5d5aa067
commit 0b326c4e76
12 changed files with 98 additions and 89 deletions
-34
View File
@@ -1,34 +0,0 @@
import { Component, DefineComponent } from "vue";
import { App, Plugin, getCurrentInstance } from "vue";
interface Registed {
[key: string]: boolean;
}
let registed: Registed = {};
interface Comp {
displayName?: string;
name?: string;
}
type RegisteComp = (comp: Comp & Plugin) => void;
const registeComp: RegisteComp = comp => {
const name = comp.displayName || comp.name;
if (name && !registed[name]) {
const instance = getCurrentInstance();
const app = instance?.appContext.app;
if (app) {
app.use(comp);
registed[name] = true;
}
}
};
const regComp: (comp: any) => void = comp => {
const instance = getCurrentInstance();
const app = instance?.appContext.app;
app?.component(comp?.name, comp);
};
export { registeComp, regComp };
-13
View File
@@ -1,8 +1,5 @@
import { h } from 'vue';
import { NIcon } from 'naive-ui';
import { ResultEnum } from "@/enums/httpEnum"
import { ErrorPageNameMap } from "@/enums/pageEnum"
import router from '@/router';
/**
* * 生成一个用不重复的ID
@@ -24,14 +21,4 @@ export const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) });
}
/**
* * 错误页重定向
* @param icon
* @returns
*/
export const redirectErrorPage = (code: ResultEnum) => {
router.push({
name: ErrorPageNameMap.get(code)
})
}
+25
View File
@@ -0,0 +1,25 @@
import { ResultEnum } from "@/enums/httpEnum"
import { ErrorPageNameMap } from "@/enums/pageEnum"
import router from '@/router';
/**
* * 错误页重定向
* @param icon
* @returns
*/
export const redirectErrorPage = (code: ResultEnum) => {
if(!code) return false
const pageName = ErrorPageNameMap.get(code)
if(!pageName) return false
routerTurnByName(pageName)
}
/**
* * 根据名字跳转路由
* @param pageName
*/
export const routerTurnByName = (pageName: string) => {
router.push({
name: pageName
})
}