feat(mock): Add mock
This commit is contained in:
3
types/componentType/configGlobal.d.ts
vendored
Normal file
3
types/componentType/configGlobal.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare interface ConfigGlobalTypes {
|
||||
size?: ElememtPlusSzie
|
||||
}
|
||||
97
types/componentType/form.d.ts
vendored
Normal file
97
types/componentType/form.d.ts
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import type { CSSProperties } from 'vue'
|
||||
|
||||
declare global {
|
||||
declare type ComponentName =
|
||||
| 'Radio'
|
||||
| 'RadioButton'
|
||||
| 'Checkbox'
|
||||
| 'CheckboxButton'
|
||||
| 'Input'
|
||||
| 'Autocomplete'
|
||||
| 'InputNumber'
|
||||
| 'Select'
|
||||
| 'Cascader'
|
||||
| 'Switch'
|
||||
| 'Slider'
|
||||
| 'TimePicker'
|
||||
| 'DatePicker'
|
||||
| 'Rate'
|
||||
| 'ColorPicker'
|
||||
| 'Transfer'
|
||||
| 'Divider'
|
||||
| 'TimeSelect'
|
||||
| 'SelectV2'
|
||||
| 'InputPassword'
|
||||
|
||||
declare type ColProps = {
|
||||
span?: number
|
||||
xs?: number
|
||||
sm?: number
|
||||
md?: number
|
||||
lg?: number
|
||||
xl?: number
|
||||
tag?: string
|
||||
}
|
||||
|
||||
declare type FormValueType = string | number | string[] | number[] | boolean | undefined | null
|
||||
|
||||
declare type FormItemProps = {
|
||||
labelWidth?: string | number
|
||||
required?: boolean
|
||||
rules?: Recordable
|
||||
error?: string
|
||||
showMessage?: boolean
|
||||
inlineMessage?: boolean
|
||||
style?: CSSProperties
|
||||
}
|
||||
|
||||
declare type ComponentOptions = {
|
||||
label?: string
|
||||
value?: FormValueType
|
||||
disabled?: boolean
|
||||
key?: string | number
|
||||
children?: ComponentOptions[]
|
||||
options?: ComponentOptions[]
|
||||
} & Recordable
|
||||
|
||||
declare type ComponentOptionsAlias = {
|
||||
labelField?: string
|
||||
valueField?: string
|
||||
}
|
||||
|
||||
declare type ComponentProps = {
|
||||
optionsAlias?: ComponentOptionsAlias
|
||||
options?: ComponentOptions[]
|
||||
optionsSlot?: boolean
|
||||
} & Recordable
|
||||
|
||||
declare type FormSchema = {
|
||||
// 唯一值
|
||||
field: string
|
||||
// 标题
|
||||
label?: string
|
||||
// col组件属性
|
||||
colProps?: ColProps
|
||||
// 表单组件属性,slots对应的是表单组件的插槽,规则:${field}-xxx,具体可以查看element-plus文档
|
||||
componentProps?: { slots?: Recordable } & ComponentProps
|
||||
// formItem组件属性
|
||||
formItemProps?: FormItemProps
|
||||
// 渲染的组件
|
||||
component?: ComponentName
|
||||
// 初始值
|
||||
value?: FormValueType
|
||||
// 是否隐藏
|
||||
hidden?: boolean
|
||||
}
|
||||
|
||||
declare type FormSetValuesType = {
|
||||
field: string
|
||||
value: FormValueType
|
||||
}
|
||||
|
||||
declare type FormSetPropsType = {
|
||||
field: string
|
||||
path: string
|
||||
value: any
|
||||
}
|
||||
}
|
||||
5
types/componentType/icon.d.ts
vendored
Normal file
5
types/componentType/icon.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare interface IconTypes {
|
||||
size?: number
|
||||
color?: string
|
||||
icon: string
|
||||
}
|
||||
10
types/componentType/localeDropdown.d.ts
vendored
Normal file
10
types/componentType/localeDropdown.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
declare interface Language {
|
||||
el: Recordable
|
||||
name: string
|
||||
}
|
||||
|
||||
declare interface LocaleDropdownType {
|
||||
lang: LocaleType
|
||||
name?: string
|
||||
elLocale?: Language
|
||||
}
|
||||
7
types/components.d.ts
vendored
Normal file
7
types/components.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
Icon: typeof import('../components/Icon/src/Icon.vue')['default']
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
14
types/env.d.ts
vendored
Normal file
14
types/env.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue'
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface ImportMeta {
|
||||
env: Record<string, unknown>
|
||||
}
|
||||
}
|
||||
31
types/global.d.ts
vendored
Normal file
31
types/global.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
declare interface Fn<T = any> {
|
||||
(...arg: T[]): T
|
||||
}
|
||||
|
||||
declare type Nullable<T> = T | null
|
||||
|
||||
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
|
||||
|
||||
declare type ElememtPlusSzie = 'default' | 'small' | 'large'
|
||||
|
||||
declare type ElementPlusInfoType = 'success' | 'info' | 'warning' | 'danger'
|
||||
|
||||
declare type Recordable<T = any, K = string> = Record<K extends null | undefined ? string : K, T>
|
||||
|
||||
declare type ComponentRef<T> = InstanceType<T>
|
||||
|
||||
declare type LocaleType = 'zh-CN' | 'en'
|
||||
|
||||
declare type AxiosConfig = {
|
||||
params?: Recordable
|
||||
data?: Recordable
|
||||
url?: string
|
||||
method?: 'get' | 'post' | 'delete' | 'put'
|
||||
headersType?: string
|
||||
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
|
||||
}
|
||||
|
||||
declare type AxiosHeadersType =
|
||||
| 'application/json'
|
||||
| 'application/x-www-form-urlencoded'
|
||||
| 'multipart/form-data'
|
||||
69
types/router.d.ts
vendored
Normal file
69
types/router.d.ts
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
/**
|
||||
* redirect: noredirect 当设置 noredirect 的时候该路由在面包屑导航中不可被点击
|
||||
* name:'router-name' 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
||||
* meta : {
|
||||
hidden: true 当设置 true 的时候该路由不会再侧边栏出现 如404,login等页面(默认 false)
|
||||
|
||||
alwaysShow: true 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式,
|
||||
只有一个时,会将那个子路由当做根路由显示在侧边栏,
|
||||
若你想不管路由下面的 children 声明的个数都显示你的根路由,
|
||||
你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,
|
||||
一直显示根路由(默认 false)
|
||||
|
||||
title: 'title' 设置该路由在侧边栏和面包屑中展示的名字
|
||||
|
||||
icon: 'svg-name' 设置该路由的图标
|
||||
|
||||
noCache: true 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
||||
|
||||
breadcrumb: false 如果设置为false,则不会在breadcrumb面包屑中显示(默认 true)
|
||||
|
||||
affix: true 如果设置为true,则会一直固定在tag项中(默认 false)
|
||||
|
||||
noTagsView: true 如果设置为true,则不会出现在tag中(默认 false)
|
||||
|
||||
activeMenu: '/dashboard' 显示高亮的路由路径
|
||||
|
||||
followAuth: '/dashboard' 跟随哪个路由进行权限过滤
|
||||
|
||||
canTo: true 设置为true即使hidden为true,也依然可以进行路由跳转(默认 false)
|
||||
|
||||
followRoute: '/dashboard' 为路由设置跟随其他路由的权限
|
||||
}
|
||||
**/
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta extends Record<string | number | symbol, unknown> {
|
||||
hidden?: boolean
|
||||
alwaysShow?: boolean
|
||||
title?: string
|
||||
icon?: string
|
||||
noCache?: boolean
|
||||
breadcrumb?: boolean
|
||||
affix?: boolean
|
||||
activeMenu?: string
|
||||
noTagsView?: boolean
|
||||
followAuth?: string
|
||||
canTo?: boolean
|
||||
followRoute?: string
|
||||
}
|
||||
}
|
||||
|
||||
type Component<T = any> =
|
||||
| ReturnType<typeof defineComponent>
|
||||
| (() => Promise<typeof import('*.vue')>)
|
||||
| (() => Promise<T>)
|
||||
|
||||
declare global {
|
||||
declare interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
|
||||
name: string
|
||||
meta: RouteMeta
|
||||
component?: Component | string
|
||||
components?: Component
|
||||
children?: AppRouteRecordRaw[]
|
||||
props?: Recordable
|
||||
fullPath?: string
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user