parent
0c37e693c2
commit
27fe5fc752
@ -1,8 +0,0 @@ |
||||
module.exports = { |
||||
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'], |
||||
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'], |
||||
'package.json': ['prettier --write'], |
||||
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'], |
||||
'*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'], |
||||
'*.md': ['prettier --write'] |
||||
} |
@ -0,0 +1,4 @@ |
||||
// Generated by 'unplugin-auto-import'
|
||||
// We suggest you to commit this file into source control
|
||||
declare global {} |
||||
export {}; |
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,10 @@ |
||||
module.exports = { |
||||
useTabs: false, |
||||
tabWidth: 2, |
||||
printWidth: 100, |
||||
semi: true, |
||||
vueIndentScriptAndStyle: true, |
||||
singleQuote: true, |
||||
trailingComma: 'none', |
||||
bracketSpacing: true, |
||||
semi: false |
||||
} |
||||
trailingComma: 'all', |
||||
proseWrap: 'never', |
||||
htmlWhitespaceSensitivity: 'strict', |
||||
endOfLine: 'auto', |
||||
}; |
||||
|
@ -1,29 +1,31 @@ |
||||
import { createApp } from 'vue' |
||||
import App from './App.vue' |
||||
import { createApp } from 'vue'; |
||||
import App from './App.vue'; |
||||
|
||||
import { setupElementPlus } from './plugins/element-plus' |
||||
import { setupVant } from './plugins/vant' |
||||
import { setupElementPlus } from './plugins/element-plus'; |
||||
import { setupVant } from './plugins/vant'; |
||||
|
||||
import 'normalize.css' |
||||
import 'virtual:windi.css' |
||||
import 'virtual:windi-devtools' |
||||
import 'animate.css' |
||||
import 'normalize.css'; |
||||
import 'virtual:windi.css'; |
||||
import 'virtual:windi-devtools'; |
||||
import 'animate.css'; |
||||
|
||||
import router from './router/' |
||||
import store from './store/' |
||||
import router from './router/'; |
||||
import { setupStore } from './store/'; |
||||
|
||||
const app = createApp(App) |
||||
const app = createApp(App); |
||||
|
||||
// 配置store
|
||||
setupStore(app); |
||||
// 使用element-plus插件
|
||||
setupElementPlus(app) |
||||
setupElementPlus(app); |
||||
// 使用vant插件
|
||||
setupVant(app) |
||||
setupVant(app); |
||||
|
||||
app.config.globalProperties.$$refs = {} |
||||
app.config.globalProperties.$$refs = {}; |
||||
|
||||
// if (import.meta.env.DEV) {
|
||||
window.$$refs = app.config.globalProperties.$$refs |
||||
window.$$refs = app.config.globalProperties.$$refs; |
||||
// }
|
||||
app.use(router).use(store) |
||||
app.use(router); |
||||
// 路由准备完毕再挂载
|
||||
router.isReady().then(() => app.mount('#app')) |
||||
router.isReady().then(() => app.mount('#app')); |
||||
|
@ -1,27 +1,10 @@ |
||||
import { createStore } from 'vuex' |
||||
import type { App } from 'vue'; |
||||
import { createPinia } from 'pinia'; |
||||
|
||||
const defaultState = { |
||||
count: 0 |
||||
} |
||||
const store = createPinia(); |
||||
|
||||
// Create a new store instance.
|
||||
export default createStore({ |
||||
state() { |
||||
return defaultState |
||||
}, |
||||
mutations: { |
||||
increment(state: typeof defaultState) { |
||||
state.count++ |
||||
} |
||||
}, |
||||
actions: { |
||||
increment(context) { |
||||
context.commit('increment') |
||||
} |
||||
}, |
||||
getters: { |
||||
double(state: typeof defaultState) { |
||||
return 2 * state.count |
||||
export function setupStore(app: App<Element>) { |
||||
app.use(store); |
||||
} |
||||
} |
||||
}) |
||||
|
||||
export { store }; |
||||
|
@ -1,13 +1,15 @@ |
||||
<!--业务组件--> |
||||
<template>业务组件</template> |
||||
|
||||
<script> |
||||
<script lang="ts"> |
||||
import { Upload } from '@element-plus/icons-vue'; |
||||
|
||||
export default { |
||||
name: 'CustomComponent', |
||||
label: '业务组件', |
||||
order: 5, |
||||
icon: 'el-icon-upload' |
||||
} |
||||
icon: Upload, |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped></style> |
||||
|
@ -0,0 +1,21 @@ |
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv { |
||||
/** 网站标题 */ |
||||
readonly VITE_APP_TITLE: string; |
||||
/** 网站部署的目录 */ |
||||
readonly VITE_BASE_URL: string; |
||||
/** API 接口路径 */ |
||||
readonly VITE_BASE_API: string; |
||||
/** socket 请求路径前缀 */ |
||||
readonly VITE_BASE_SOCKET_PATH: string; |
||||
/** socket 命名空间 */ |
||||
readonly VITE_BASE_SOCKET_NSP: string; |
||||
/** mock API 路径 */ |
||||
readonly VITE_MOCK_API: string; |
||||
// 更多环境变量...
|
||||
} |
||||
|
||||
interface ImportMeta { |
||||
readonly env: ImportMetaEnv; |
||||
} |
@ -0,0 +1,83 @@ |
||||
import type { |
||||
ComponentRenderProxy, |
||||
VNode, |
||||
VNodeChild, |
||||
ComponentPublicInstance, |
||||
FunctionalComponent, |
||||
PropType as VuePropType, |
||||
} from 'vue'; |
||||
|
||||
declare global { |
||||
const __APP_INFO__: { |
||||
pkg: { |
||||
name: string; |
||||
version: string; |
||||
dependencies: Recordable<string>; |
||||
devDependencies: Recordable<string>; |
||||
}; |
||||
lastBuildTime: string; |
||||
}; |
||||
// declare interface Window {
|
||||
// // Global vue app instance
|
||||
// __APP__: App<Element>;
|
||||
// }
|
||||
|
||||
// vue
|
||||
declare type PropType<T> = VuePropType<T>; |
||||
declare type VueNode = VNodeChild | JSX.Element; |
||||
|
||||
export type Writable<T> = { |
||||
-readonly [P in keyof T]: T[P]; |
||||
}; |
||||
type RemoveIndex<T> = { |
||||
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; |
||||
}; |
||||
declare type Nullable<T> = T | null; |
||||
declare type NonNullable<T> = T extends null | undefined ? never : T; |
||||
declare type Recordable<T = any> = Record<string, T>; |
||||
declare type ReadonlyRecordable<T = any> = { |
||||
readonly [key: string]: T; |
||||
}; |
||||
declare type Indexable<T = any> = { |
||||
[key: string]: T; |
||||
}; |
||||
declare type DeepPartial<T> = { |
||||
[P in keyof T]?: DeepPartial<T[P]>; |
||||
}; |
||||
|
||||
declare type TimeoutHandle = ReturnType<typeof setTimeout>; |
||||
declare type IntervalHandle = ReturnType<typeof setInterval>; |
||||
|
||||
declare interface ChangeEvent extends Event { |
||||
target: HTMLInputElement; |
||||
} |
||||
|
||||
declare interface WheelEvent { |
||||
path?: EventTarget[]; |
||||
} |
||||
declare function parseInt(s: string | number, radix?: number): number; |
||||
|
||||
declare function parseFloat(string: string | number): number; |
||||
|
||||
namespace JSX { |
||||
// tslint:disable no-empty-interface
|
||||
type Element = VNode; |
||||
// tslint:disable no-empty-interface
|
||||
type ElementClass = ComponentRenderProxy; |
||||
interface ElementAttributesProperty { |
||||
$props: any; |
||||
} |
||||
interface IntrinsicElements { |
||||
[elem: string]: any; |
||||
} |
||||
interface IntrinsicAttributes { |
||||
[elem: string]: any; |
||||
} |
||||
} |
||||
} |
||||
|
||||
declare module 'vue' { |
||||
export type JSXComponent<Props = any> = |
||||
| { new (): ComponentPublicInstance<Props> } |
||||
| FunctionalComponent<Props>; |
||||
} |
@ -0,0 +1,34 @@ |
||||
declare interface Fn<T = any, R = T> { |
||||
(...arg: T[]): R; |
||||
} |
||||
|
||||
declare interface PromiseFn<T = any, R = T> { |
||||
(...arg: T[]): Promise<R>; |
||||
} |
||||
|
||||
declare type RefType<T> = T | null; |
||||
|
||||
declare type LabelValueOptions = { |
||||
label: string; |
||||
value: any; |
||||
[key: string]: string | number | boolean; |
||||
}[]; |
||||
|
||||
declare type EmitType = (event: string, ...args: any[]) => void; |
||||
|
||||
declare type TargetContext = '_self' | '_blank'; |
||||
|
||||
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> { |
||||
$el: T; |
||||
} |
||||
|
||||
/** 将联合类型转为交叉类型 */ |
||||
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ( |
||||
k: infer I, |
||||
) => void |
||||
? I |
||||
: never; |
||||
|
||||
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null; |
||||
|
||||
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>; |
@ -0,0 +1,20 @@ |
||||
declare module '*.vue' { |
||||
import { DefineComponent } from 'vue'; |
||||
const Component: DefineComponent<{}, {}, any>; |
||||
export default Component; |
||||
} |
||||
|
||||
declare module 'mitt' { |
||||
import mitt from 'mitt'; |
||||
export default mitt; |
||||
} |
||||
|
||||
declare module 'blueimp-md5' { |
||||
import md5 from 'blueimp-md5'; |
||||
export default md5; |
||||
} |
||||
|
||||
declare module 'virtual:*' { |
||||
const result: any; |
||||
export default result; |
||||
} |
@ -1,67 +1,67 @@ |
||||
declare module '*.bmp' { |
||||
const src: string |
||||
export default src |
||||
const src: string; |
||||
export default src; |
||||
} |
||||
|
||||
declare module '*.gif' { |
||||
const src: string |
||||
export default src |
||||
const src: string; |
||||
export default src; |
||||
} |
||||
|
||||
declare module '*.jpg' { |
||||
const src: string |
||||
export default src |
||||
const src: string; |
||||
export default src; |
||||
} |
||||
|
||||
declare module '*.jpeg' { |
||||
const src: string |
||||
export default src |
||||
const src: string; |
||||
export default src; |
||||
} |
||||
|
||||
declare module '*.png' { |
||||
const src: string |
||||
export default src |
||||
const src: string; |
||||
export default src; |
||||
} |
||||
|
||||
declare module '*.webp' { |
||||
const src: string |
||||
export default src |
||||
const src: string; |
||||
export default src; |
||||
} |
||||
|
||||
declare module '*.module.css' { |
||||
const classes: { readonly [key: string]: string } |
||||
export default classes |
||||
const classes: { readonly [key: string]: string }; |
||||
export default classes; |
||||
} |
||||
|
||||
declare module '*.module.scss' { |
||||
const classes: { readonly [key: string]: string } |
||||
export default classes |
||||
const classes: { readonly [key: string]: string }; |
||||
export default classes; |
||||
} |
||||
|
||||
declare module '*.module.less' { |
||||
const classes: { readonly [key: string]: string } |
||||
export default classes |
||||
const classes: { readonly [key: string]: string }; |
||||
export default classes; |
||||
} |
||||
|
||||
declare module '*.module.sass' { |
||||
const classes: { readonly [key: string]: string } |
||||
export default classes |
||||
const classes: { readonly [key: string]: string }; |
||||
export default classes; |
||||
} |
||||
|
||||
declare module 'moment/locale/*' { |
||||
const LocaleMessage: { [key: string]: any } |
||||
export default LocaleMessage |
||||
const LocaleMessage: { [key: string]: any }; |
||||
export default LocaleMessage; |
||||
} |
||||
|
||||
declare module 'ant-design-vue/es/locale-provider/*' { |
||||
const LocaleMessage: { [key: string]: any } |
||||
export default LocaleMessage |
||||
const LocaleMessage: { [key: string]: any }; |
||||
export default LocaleMessage; |
||||
} |
||||
|
||||
// ant-design-vue/es/base
|
||||
declare module 'ant-design-vue/es/base' { |
||||
class Base { |
||||
static install(vue: typeof Vue): void |
||||
static install(vue: typeof Vue): void; |
||||
} |
||||
export default Base |
||||
export default Base; |
||||
} |
||||
|
@ -0,0 +1,34 @@ |
||||
import { type PermissionType } from '@/core/permission/modules/types'; |
||||
|
||||
interface Title18n { |
||||
zh_CN: string; |
||||
en_US: string; |
||||
} |
||||
|
||||
declare module 'vue-router' { |
||||
interface RouteMeta extends Record<string | number | symbol, unknown> { |
||||
/** 标题 */ |
||||
title: string | Title18n; |
||||
/** 当前路由是否需要权限验证 */ |
||||
isAuth?: boolean; |
||||
/** 当前路由权限 */ |
||||
perms?: PermissionType[]; |
||||
/** 是否需要缓存 */ |
||||
keepAlive?: boolean; |
||||
/** 当前路由namePath 祖先name集合 */ |
||||
namePath?: string[]; |
||||
/** 当前路由所在的完整路径 */ |
||||
fullPath?: string; |
||||
/** 是否固定在标签栏 */ |
||||
affix?: boolean; |
||||
/** 菜单图标 */ |
||||
icon?: string; |
||||
/** 当前页面切换动画 */ |
||||
transitionName?: string; |
||||
/** 不在菜单中显示 */ |
||||
hideInMenu?: boolean; |
||||
/** 设置当前路由高亮的菜单项,值为route fullPath或route name,一般用于详情页 */ |
||||
activeMenu?: string; |
||||
isLink?: boolean; |
||||
} |
||||
} |
Loading…
Reference in new issue