refactor: 优先采用普通导出而不是默认导出
This commit is contained in:
parent
0f5f16cf0f
commit
51e7cd95a6
@ -21,10 +21,8 @@ interface RouteSettings {
|
||||
thirdLevelRouteCache: boolean
|
||||
}
|
||||
|
||||
const routeSettings: RouteSettings = {
|
||||
export const routeSettings: RouteSettings = {
|
||||
dynamic: true,
|
||||
defaultRoles: ["DEFAULT_ROLE"],
|
||||
thirdLevelRouteCache: false
|
||||
}
|
||||
|
||||
export default routeSettings
|
||||
|
@ -7,9 +7,7 @@ const whiteListByPath: string[] = ["/login"]
|
||||
const whiteListByName: RouteRecordNameGeneric[] = []
|
||||
|
||||
/** 判断是否在白名单 */
|
||||
function isWhiteList(to: RouteLocationNormalized) {
|
||||
export function isWhiteList(to: RouteLocationNormalized) {
|
||||
// path 和 name 任意一个匹配上即可
|
||||
return whiteListByPath.includes(to.path) || whiteListByName.includes(to.name)
|
||||
}
|
||||
|
||||
export default isWhiteList
|
||||
|
@ -1,7 +1,7 @@
|
||||
const SYSTEM_NAME = "v3-admin-vite"
|
||||
|
||||
/** 缓存数据时用到的 Key */
|
||||
class CacheKey {
|
||||
export class CacheKey {
|
||||
static readonly TOKEN = `${SYSTEM_NAME}-token-key`
|
||||
static readonly CONFIG_LAYOUT = `${SYSTEM_NAME}-config-layout-key`
|
||||
static readonly SIDEBAR_STATUS = `${SYSTEM_NAME}-sidebar-status-key`
|
||||
@ -9,5 +9,3 @@ class CacheKey {
|
||||
static readonly VISITED_VIEWS = `${SYSTEM_NAME}-visited-views-key`
|
||||
static readonly CACHED_VIEWS = `${SYSTEM_NAME}-cached-views-key`
|
||||
}
|
||||
|
||||
export default CacheKey
|
||||
|
@ -5,8 +5,8 @@ import type { VxeFormInstance, VxeFormProps, VxeGridInstance, VxeGridProps, VxeM
|
||||
import { deleteTableDataApi, getTableDataApi } from "@/http/table"
|
||||
import { ElMessage, ElMessageBox } from "element-plus"
|
||||
import { nextTick, reactive, ref } from "vue"
|
||||
import RoleColumnSolts from "./tsx/RoleColumnSolts"
|
||||
import StatusColumnSolts from "./tsx/StatusColumnSolts"
|
||||
import { RoleColumnSolts } from "./tsx/RoleColumnSolts"
|
||||
import { StatusColumnSolts } from "./tsx/StatusColumnSolts"
|
||||
|
||||
defineOptions({
|
||||
// 命名当前组件
|
||||
|
@ -1,11 +1,9 @@
|
||||
import type { VxeColumnPropTypes } from "vxe-table/types/column"
|
||||
|
||||
const solts: VxeColumnPropTypes.Slots = {
|
||||
export const RoleColumnSolts: VxeColumnPropTypes.Slots = {
|
||||
default: ({ row, column }) => {
|
||||
const cellValue = row[column.field]
|
||||
const type = cellValue === "admin" ? "primary" : "warning"
|
||||
return [<span class={`el-tag el-tag--${type} el-tag--plain`}>{cellValue}</span>]
|
||||
}
|
||||
}
|
||||
|
||||
export default solts
|
||||
|
@ -1,11 +1,9 @@
|
||||
import type { VxeColumnPropTypes } from "vxe-table/types/column"
|
||||
|
||||
const solts: VxeColumnPropTypes.Slots = {
|
||||
export const StatusColumnSolts: VxeColumnPropTypes.Slots = {
|
||||
default: ({ row, column }) => {
|
||||
const cellValue = row[column.field]
|
||||
const [type, value] = cellValue ? ["success", "启用"] : ["danger", "禁用"]
|
||||
return [<span class={`el-tag el-tag--${type} el-tag--plain`}>{value}</span>]
|
||||
}
|
||||
}
|
||||
|
||||
export default solts
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { RouteRecordRaw } from "vue-router"
|
||||
import routeSettings from "@/config/route"
|
||||
import { routeSettings } from "@/config/route"
|
||||
import { pinia } from "@/pinia"
|
||||
import { constantRoutes, dynamicRoutes } from "@/router"
|
||||
import { flatMultiLevelRoutes } from "@/router/helper"
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { LoginRequestData } from "@/http/login/types/login"
|
||||
import routeSettings from "@/config/route"
|
||||
import { routeSettings } from "@/config/route"
|
||||
import { getUserInfoApi, loginApi } from "@/http/login"
|
||||
import { pinia } from "@/pinia"
|
||||
import { resetRouter } from "@/router"
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { RouteRecordRaw } from "vue-router"
|
||||
import routeSettings from "@/config/route"
|
||||
import { routeSettings } from "@/config/route"
|
||||
import { createRouter } from "vue-router"
|
||||
import { flatMultiLevelRoutes, history } from "./helper"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { setRouteChange } from "@/composables/useRouteListener"
|
||||
import { useTitle } from "@/composables/useTitle"
|
||||
import routeSettings from "@/config/route"
|
||||
import isWhiteList from "@/config/white-list"
|
||||
import { routeSettings } from "@/config/route"
|
||||
import { isWhiteList } from "@/config/white-list"
|
||||
import { usePermissionStore } from "@/pinia/stores/permission"
|
||||
import { useUserStore } from "@/pinia/stores/user"
|
||||
import { router } from "@/router"
|
||||
|
2
src/utils/cache/cookies.ts
vendored
2
src/utils/cache/cookies.ts
vendored
@ -1,6 +1,6 @@
|
||||
// 统一处理 Cookie
|
||||
|
||||
import CacheKey from "@/constants/cache-key"
|
||||
import { CacheKey } from "@/constants/cache-key"
|
||||
import Cookies from "js-cookie"
|
||||
|
||||
export function getToken() {
|
||||
|
2
src/utils/cache/local-storage.ts
vendored
2
src/utils/cache/local-storage.ts
vendored
@ -4,7 +4,7 @@ import type { ThemeName } from "@/composables/useTheme"
|
||||
import type { LayoutSettings } from "@/config/layouts"
|
||||
import type { SidebarClosed, SidebarOpened } from "@/constants/app-key"
|
||||
import type { TagView } from "@/pinia/stores/tags-view"
|
||||
import CacheKey from "@/constants/cache-key"
|
||||
import { CacheKey } from "@/constants/cache-key"
|
||||
|
||||
// #region 系统布局配置
|
||||
export function getConfigLayout() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user