jdcProject_front/src/router/whitelist.ts

14 lines
501 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { RouteLocationNormalized, RouteRecordNameGeneric } from "vue-router"
/** 免登录白名单(匹配路由 path */
const whiteListByPath: string[] = ["/login"]
/** 免登录白名单(匹配路由 name */
const whiteListByName: RouteRecordNameGeneric[] = []
/** 判断是否在白名单 */
export function isWhiteList(to: RouteLocationNormalized) {
// path 和 name 任意一个匹配上即可
return whiteListByPath.includes(to.path) || whiteListByName.includes(to.name)
}