mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-06 03:57:49 +08:00
一些小细节修改
This commit is contained in:
parent
b8063b8d47
commit
d4ad3573df
26
cfg.ts
26
cfg.ts
@ -2,31 +2,9 @@ import path from 'node:path'
|
|||||||
|
|
||||||
import { HTMLTitlePlugin, buildOptions } from './vite-plugin/index'
|
import { HTMLTitlePlugin, buildOptions } from './vite-plugin/index'
|
||||||
|
|
||||||
import type { ServerOptions, BuildOptions, AliasOptions } from 'vite'
|
import type { AppConfigExport } from './src/types/cfg'
|
||||||
import type { VNodeChild } from 'vue'
|
|
||||||
|
|
||||||
export interface HTMLTitle {
|
const config: AppConfigExport = {
|
||||||
name: string
|
|
||||||
transformIndexHtml: (title: string) => string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SideBarLogo {
|
|
||||||
icon?: string
|
|
||||||
title?: string
|
|
||||||
url?: string
|
|
||||||
jumpType?: 'station' | 'outsideStation'
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Config {
|
|
||||||
server: ServerOptions
|
|
||||||
buildOptions: (mode: string) => BuildOptions
|
|
||||||
alias: AliasOptions
|
|
||||||
title: HTMLTitle
|
|
||||||
copyright?: string | number | VNodeChild
|
|
||||||
sideBarLogo: SideBarLogo
|
|
||||||
}
|
|
||||||
|
|
||||||
const config: Config = {
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* icon: LOGO 图标, 依赖 `RayIcon` 实现
|
* icon: LOGO 图标, 依赖 `RayIcon` 实现
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
display: none;
|
display: none;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
white-space: nowrap;
|
@include overflowEllipsis;
|
||||||
|
|
||||||
&.ray-menu__logo-title--open {
|
&.ray-menu__logo-title--open {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
import { NMenu, NLayoutSider } from 'naive-ui'
|
import { NMenu, NLayoutSider, NEllipsis } from 'naive-ui'
|
||||||
import RayIcon from '@/components/RayIcon/index'
|
import RayIcon from '@/components/RayIcon/index'
|
||||||
|
|
||||||
import { useMenu } from '@/store'
|
import { useMenu } from '@/store'
|
||||||
@ -53,6 +53,7 @@ const LayoutMenu = defineComponent({
|
|||||||
collapseMode="width"
|
collapseMode="width"
|
||||||
collapsedWidth={this.collapsedWidth}
|
collapsedWidth={this.collapsedWidth}
|
||||||
onUpdateCollapsed={this.collapsedMenu.bind(this)}
|
onUpdateCollapsed={this.collapsedMenu.bind(this)}
|
||||||
|
nativeScrollbar={false}
|
||||||
>
|
>
|
||||||
{this.sideBarLogo ? (
|
{this.sideBarLogo ? (
|
||||||
<div
|
<div
|
||||||
@ -69,7 +70,7 @@ const LayoutMenu = defineComponent({
|
|||||||
'ray-menu__logo-title',
|
'ray-menu__logo-title',
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{this.sideBarLogo.title}
|
<NEllipsis>{this.sideBarLogo.title}</NEllipsis>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -20,7 +20,7 @@ const Layout = defineComponent({
|
|||||||
|
|
||||||
if (menuStore.menuTagSwitch) {
|
if (menuStore.menuTagSwitch) {
|
||||||
cssVar = {
|
cssVar = {
|
||||||
'--layout-content-height': 'calc(100% - 109px)',
|
'--layout-content-height': 'calc(100% - 110px)',
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cssVar = {
|
cssVar = {
|
||||||
|
47
src/types/cfg.ts
Normal file
47
src/types/cfg.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import type { VNodeChild } from 'vue'
|
||||||
|
import type {
|
||||||
|
ServerOptions,
|
||||||
|
BuildOptions,
|
||||||
|
AliasOptions,
|
||||||
|
UserConfigExport,
|
||||||
|
} from 'vite'
|
||||||
|
|
||||||
|
export interface LayoutSideBarLogo {
|
||||||
|
icon?: string
|
||||||
|
title?: string
|
||||||
|
url?: string
|
||||||
|
jumpType?: 'station' | 'outsideStation'
|
||||||
|
}
|
||||||
|
|
||||||
|
export type LayoutCopyright = string | number | VNodeChild
|
||||||
|
|
||||||
|
export interface HTMLTitle {
|
||||||
|
name: string
|
||||||
|
transformIndexHtml: (title: string) => string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Config {
|
||||||
|
server: ServerOptions
|
||||||
|
buildOptions: (mode: string) => BuildOptions
|
||||||
|
alias: AliasOptions
|
||||||
|
title: HTMLTitle
|
||||||
|
copyright?: LayoutCopyright
|
||||||
|
sideBarLogo?: LayoutSideBarLogo
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Recordable<T = unknown> = Record<string, T>
|
||||||
|
|
||||||
|
export interface AppConfig {
|
||||||
|
pkg: {
|
||||||
|
name: string
|
||||||
|
version: string
|
||||||
|
dependencies: Recordable<string>
|
||||||
|
devDependencies: Recordable<string>
|
||||||
|
}
|
||||||
|
layout: {
|
||||||
|
copyright?: LayoutCopyright
|
||||||
|
sideBarLogo?: LayoutSideBarLogo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AppConfigExport = Config & UserConfigExport
|
23
src/types/index.d.ts
vendored
23
src/types/index.d.ts
vendored
@ -12,29 +12,10 @@ import type {
|
|||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import type { ECharts } from 'echarts/core'
|
import type { ECharts } from 'echarts/core'
|
||||||
import type { VNodeChild } from 'vue'
|
import type { VNodeChild } from 'vue'
|
||||||
|
import type { LayoutSideBarLogo, LayoutCopyright, AppConfig } from './cfg'
|
||||||
|
|
||||||
export global {
|
export global {
|
||||||
declare type Recordable<T = unknown> = Record<string, T>
|
declare const __APP_CFG__: AppConfig
|
||||||
|
|
||||||
export declare interface SideBarLogo {
|
|
||||||
icon?: string
|
|
||||||
title?: string
|
|
||||||
url?: string
|
|
||||||
jumpType?: 'station' | 'outsideStation'
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const __APP_CFG__: {
|
|
||||||
pkg: {
|
|
||||||
name: string
|
|
||||||
version: string
|
|
||||||
dependencies: Recordable<string>
|
|
||||||
devDependencies: Recordable<string>
|
|
||||||
}
|
|
||||||
layout: {
|
|
||||||
copyright?: string | number | VNodeChild
|
|
||||||
sideBarLogo?: SideBarLogo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare type NaiveMenuOptions =
|
declare type NaiveMenuOptions =
|
||||||
| MenuOption
|
| MenuOption
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"vite.config.ts",
|
"vite.config.ts",
|
||||||
"vite-plugin/index.ts",
|
"vite-plugin/index.ts",
|
||||||
"vite-plugin/type.ts",
|
"vite-plugin/type.ts",
|
||||||
"cfg.ts"
|
"cfg.ts",
|
||||||
|
"src/types/cfg.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // `svg icon`
|
|||||||
import type { ComponentResolver, TypeImport } from 'unplugin-vue-components'
|
import type { ComponentResolver, TypeImport } from 'unplugin-vue-components'
|
||||||
import type { VitePluginCompression } from './type'
|
import type { VitePluginCompression } from './type'
|
||||||
import type { ImportsMap, PresetName } from 'unplugin-auto-import/types'
|
import type { ImportsMap, PresetName } from 'unplugin-auto-import/types'
|
||||||
import type { ServerOptions, BuildOptions } from 'vite'
|
import type { BuildOptions } from 'vite'
|
||||||
import type { ViteSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
import type { ViteSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user