mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-05 19:42:07 +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 type { ServerOptions, BuildOptions, AliasOptions } from 'vite'
|
||||
import type { VNodeChild } from 'vue'
|
||||
import type { AppConfigExport } from './src/types/cfg'
|
||||
|
||||
export interface HTMLTitle {
|
||||
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 = {
|
||||
const config: AppConfigExport = {
|
||||
/**
|
||||
*
|
||||
* icon: LOGO 图标, 依赖 `RayIcon` 实现
|
||||
|
@ -17,7 +17,7 @@
|
||||
opacity: 0;
|
||||
display: none;
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
@include overflowEllipsis;
|
||||
|
||||
&.ray-menu__logo-title--open {
|
||||
opacity: 1;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import './index.scss'
|
||||
|
||||
import { NMenu, NLayoutSider } from 'naive-ui'
|
||||
import { NMenu, NLayoutSider, NEllipsis } from 'naive-ui'
|
||||
import RayIcon from '@/components/RayIcon/index'
|
||||
|
||||
import { useMenu } from '@/store'
|
||||
@ -53,6 +53,7 @@ const LayoutMenu = defineComponent({
|
||||
collapseMode="width"
|
||||
collapsedWidth={this.collapsedWidth}
|
||||
onUpdateCollapsed={this.collapsedMenu.bind(this)}
|
||||
nativeScrollbar={false}
|
||||
>
|
||||
{this.sideBarLogo ? (
|
||||
<div
|
||||
@ -69,7 +70,7 @@ const LayoutMenu = defineComponent({
|
||||
'ray-menu__logo-title',
|
||||
]}
|
||||
>
|
||||
{this.sideBarLogo.title}
|
||||
<NEllipsis>{this.sideBarLogo.title}</NEllipsis>
|
||||
</h1>
|
||||
</div>
|
||||
) : (
|
||||
|
@ -20,7 +20,7 @@ const Layout = defineComponent({
|
||||
|
||||
if (menuStore.menuTagSwitch) {
|
||||
cssVar = {
|
||||
'--layout-content-height': 'calc(100% - 109px)',
|
||||
'--layout-content-height': 'calc(100% - 110px)',
|
||||
}
|
||||
} else {
|
||||
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'
|
||||
import type { ECharts } from 'echarts/core'
|
||||
import type { VNodeChild } from 'vue'
|
||||
import type { LayoutSideBarLogo, LayoutCopyright, AppConfig } from './cfg'
|
||||
|
||||
export global {
|
||||
declare type Recordable<T = unknown> = Record<string, T>
|
||||
|
||||
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 const __APP_CFG__: AppConfig
|
||||
|
||||
declare type NaiveMenuOptions =
|
||||
| MenuOption
|
||||
|
@ -9,6 +9,7 @@
|
||||
"vite.config.ts",
|
||||
"vite-plugin/index.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 { VitePluginCompression } from './type'
|
||||
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'
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user