修改uts类型
This commit is contained in:
@@ -5,7 +5,7 @@ import { storage, last, isNull, isEmpty, get, isFunction, toArray, map, debounce
|
||||
// 路由信息类型
|
||||
type RouteInfo = {
|
||||
path: string;
|
||||
meta: UTSJSONObject;
|
||||
meta?: UTSJSONObject;
|
||||
};
|
||||
|
||||
// 跳转前钩子类型
|
||||
@@ -55,8 +55,8 @@ export class Router {
|
||||
}
|
||||
// 获取页面样式
|
||||
const page = PAGES.find((e) => e.path == path);
|
||||
const style = page?.style ?? {};
|
||||
const meta = page?.meta ?? {};
|
||||
const style = page?.style;
|
||||
const meta = page?.meta;
|
||||
// 获取页面暴露的方法
|
||||
// @ts-ignore
|
||||
let exposed = e.vm as any;
|
||||
|
||||
@@ -53,4 +53,5 @@ export type PageInstance = {
|
||||
query: UTSJSONObject;
|
||||
exposed: any;
|
||||
isCustomNavbar: boolean;
|
||||
meta?: UTSJSONObject;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cool-unix",
|
||||
"appid": "__UNI__651711F",
|
||||
"appid": "__UNI__EC807C1",
|
||||
"description": "完全开源、永久免费、上手容易、效率极高的开发脚手架",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
|
||||
@@ -2,15 +2,13 @@ import { router, useStore } from "@/cool";
|
||||
|
||||
router.beforeEach((to, _, next) => {
|
||||
const { user } = useStore();
|
||||
if (
|
||||
!to.meta.isAuth
|
||||
) {
|
||||
next();
|
||||
} else {
|
||||
if (to.meta?.isAuth == true) {
|
||||
if (!user.isNull()) {
|
||||
next();
|
||||
} else {
|
||||
router.login();
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user