refactor: 优先采用普通导出而不是默认导出

This commit is contained in:
pany 2024-11-25 17:42:52 +08:00
parent 0f5f16cf0f
commit 51e7cd95a6
12 changed files with 14 additions and 24 deletions

View File

@ -21,10 +21,8 @@ interface RouteSettings {
thirdLevelRouteCache: boolean thirdLevelRouteCache: boolean
} }
const routeSettings: RouteSettings = { export const routeSettings: RouteSettings = {
dynamic: true, dynamic: true,
defaultRoles: ["DEFAULT_ROLE"], defaultRoles: ["DEFAULT_ROLE"],
thirdLevelRouteCache: false thirdLevelRouteCache: false
} }
export default routeSettings

View File

@ -7,9 +7,7 @@ const whiteListByPath: string[] = ["/login"]
const whiteListByName: RouteRecordNameGeneric[] = [] const whiteListByName: RouteRecordNameGeneric[] = []
/** 判断是否在白名单 */ /** 判断是否在白名单 */
function isWhiteList(to: RouteLocationNormalized) { export function isWhiteList(to: RouteLocationNormalized) {
// path 和 name 任意一个匹配上即可 // path 和 name 任意一个匹配上即可
return whiteListByPath.includes(to.path) || whiteListByName.includes(to.name) return whiteListByPath.includes(to.path) || whiteListByName.includes(to.name)
} }
export default isWhiteList

View File

@ -1,7 +1,7 @@
const SYSTEM_NAME = "v3-admin-vite" const SYSTEM_NAME = "v3-admin-vite"
/** 缓存数据时用到的 Key */ /** 缓存数据时用到的 Key */
class CacheKey { export class CacheKey {
static readonly TOKEN = `${SYSTEM_NAME}-token-key` static readonly TOKEN = `${SYSTEM_NAME}-token-key`
static readonly CONFIG_LAYOUT = `${SYSTEM_NAME}-config-layout-key` static readonly CONFIG_LAYOUT = `${SYSTEM_NAME}-config-layout-key`
static readonly SIDEBAR_STATUS = `${SYSTEM_NAME}-sidebar-status-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 VISITED_VIEWS = `${SYSTEM_NAME}-visited-views-key`
static readonly CACHED_VIEWS = `${SYSTEM_NAME}-cached-views-key` static readonly CACHED_VIEWS = `${SYSTEM_NAME}-cached-views-key`
} }
export default CacheKey

View File

@ -5,8 +5,8 @@ import type { VxeFormInstance, VxeFormProps, VxeGridInstance, VxeGridProps, VxeM
import { deleteTableDataApi, getTableDataApi } from "@/http/table" import { deleteTableDataApi, getTableDataApi } from "@/http/table"
import { ElMessage, ElMessageBox } from "element-plus" import { ElMessage, ElMessageBox } from "element-plus"
import { nextTick, reactive, ref } from "vue" import { nextTick, reactive, ref } from "vue"
import RoleColumnSolts from "./tsx/RoleColumnSolts" import { RoleColumnSolts } from "./tsx/RoleColumnSolts"
import StatusColumnSolts from "./tsx/StatusColumnSolts" import { StatusColumnSolts } from "./tsx/StatusColumnSolts"
defineOptions({ defineOptions({
// //

View File

@ -1,11 +1,9 @@
import type { VxeColumnPropTypes } from "vxe-table/types/column" import type { VxeColumnPropTypes } from "vxe-table/types/column"
const solts: VxeColumnPropTypes.Slots = { export const RoleColumnSolts: VxeColumnPropTypes.Slots = {
default: ({ row, column }) => { default: ({ row, column }) => {
const cellValue = row[column.field] const cellValue = row[column.field]
const type = cellValue === "admin" ? "primary" : "warning" const type = cellValue === "admin" ? "primary" : "warning"
return [<span class={`el-tag el-tag--${type} el-tag--plain`}>{cellValue}</span>] return [<span class={`el-tag el-tag--${type} el-tag--plain`}>{cellValue}</span>]
} }
} }
export default solts

View File

@ -1,11 +1,9 @@
import type { VxeColumnPropTypes } from "vxe-table/types/column" import type { VxeColumnPropTypes } from "vxe-table/types/column"
const solts: VxeColumnPropTypes.Slots = { export const StatusColumnSolts: VxeColumnPropTypes.Slots = {
default: ({ row, column }) => { default: ({ row, column }) => {
const cellValue = row[column.field] const cellValue = row[column.field]
const [type, value] = cellValue ? ["success", "启用"] : ["danger", "禁用"] const [type, value] = cellValue ? ["success", "启用"] : ["danger", "禁用"]
return [<span class={`el-tag el-tag--${type} el-tag--plain`}>{value}</span>] return [<span class={`el-tag el-tag--${type} el-tag--plain`}>{value}</span>]
} }
} }
export default solts

View File

@ -1,5 +1,5 @@
import type { RouteRecordRaw } from "vue-router" import type { RouteRecordRaw } from "vue-router"
import routeSettings from "@/config/route" import { routeSettings } from "@/config/route"
import { pinia } from "@/pinia" import { pinia } from "@/pinia"
import { constantRoutes, dynamicRoutes } from "@/router" import { constantRoutes, dynamicRoutes } from "@/router"
import { flatMultiLevelRoutes } from "@/router/helper" import { flatMultiLevelRoutes } from "@/router/helper"

View File

@ -1,5 +1,5 @@
import type { LoginRequestData } from "@/http/login/types/login" 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 { getUserInfoApi, loginApi } from "@/http/login"
import { pinia } from "@/pinia" import { pinia } from "@/pinia"
import { resetRouter } from "@/router" import { resetRouter } from "@/router"

View File

@ -1,5 +1,5 @@
import type { RouteRecordRaw } from "vue-router" import type { RouteRecordRaw } from "vue-router"
import routeSettings from "@/config/route" import { routeSettings } from "@/config/route"
import { createRouter } from "vue-router" import { createRouter } from "vue-router"
import { flatMultiLevelRoutes, history } from "./helper" import { flatMultiLevelRoutes, history } from "./helper"

View File

@ -1,7 +1,7 @@
import { setRouteChange } from "@/composables/useRouteListener" import { setRouteChange } from "@/composables/useRouteListener"
import { useTitle } from "@/composables/useTitle" import { useTitle } from "@/composables/useTitle"
import routeSettings from "@/config/route" import { routeSettings } from "@/config/route"
import isWhiteList from "@/config/white-list" import { isWhiteList } from "@/config/white-list"
import { usePermissionStore } from "@/pinia/stores/permission" import { usePermissionStore } from "@/pinia/stores/permission"
import { useUserStore } from "@/pinia/stores/user" import { useUserStore } from "@/pinia/stores/user"
import { router } from "@/router" import { router } from "@/router"

View File

@ -1,6 +1,6 @@
// 统一处理 Cookie // 统一处理 Cookie
import CacheKey from "@/constants/cache-key" import { CacheKey } from "@/constants/cache-key"
import Cookies from "js-cookie" import Cookies from "js-cookie"
export function getToken() { export function getToken() {

View File

@ -4,7 +4,7 @@ import type { ThemeName } from "@/composables/useTheme"
import type { LayoutSettings } from "@/config/layouts" import type { LayoutSettings } from "@/config/layouts"
import type { SidebarClosed, SidebarOpened } from "@/constants/app-key" import type { SidebarClosed, SidebarOpened } from "@/constants/app-key"
import type { TagView } from "@/pinia/stores/tags-view" import type { TagView } from "@/pinia/stores/tags-view"
import CacheKey from "@/constants/cache-key" import { CacheKey } from "@/constants/cache-key"
// #region 系统布局配置 // #region 系统布局配置
export function getConfigLayout() { export function getConfigLayout() {