-
-
Notifications
You must be signed in to change notification settings - Fork 948
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: no keywords "any" and "unknown"
- Loading branch information
Showing
5 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { type RouteLocationNormalized } from "vue-router" | ||
import { type RouteLocationNormalized, type RouteRecordNameGeneric } from "vue-router" | ||
|
||
/** 免登录白名单(匹配路由 path) */ | ||
const whiteListByPath: string[] = ["/login"] | ||
|
||
/** 免登录白名单(匹配路由 name) */ | ||
const whiteListByName: string[] = [] | ||
const whiteListByName: RouteRecordNameGeneric[] = [] | ||
|
||
/** 判断是否在白名单 */ | ||
const isWhiteList = (to: RouteLocationNormalized) => { | ||
// path 和 name 任意一个匹配上即可 | ||
return whiteListByPath.indexOf(to.path) !== -1 || whiteListByName.indexOf(to.name as any) !== -1 | ||
return whiteListByPath.indexOf(to.path) !== -1 || whiteListByName.indexOf(to.name) !== -1 | ||
} | ||
|
||
export default isWhiteList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters