feat(projects): 添加请求适配adapter层应用的示例页面

This commit is contained in:
Soybean
2022-07-30 22:16:42 +08:00
parent f6b61418e5
commit 8d11a6affc
14 changed files with 228 additions and 86 deletions

View File

@ -1,69 +1 @@
import type { DataTableColumn } from 'naive-ui';
type UnionColumn<T> = T extends DataTableColumn[] ? TypeUtil.ArrayToUnion<T> : never;
type ColumnKey = 'key';
type InterfaceArray = {
[key: string]: unknown;
};
type ColumnKeyData = {
key: unknown;
};
type ExcludeArrayByKey<T extends InterfaceArray[]> = T extends [infer First, ...infer Rest]
? First extends ColumnKeyData
? Rest extends InterfaceArray[]
? [First, ...ExcludeArrayByKey<Rest>]
: [First]
: Rest extends InterfaceArray[]
? ExcludeArrayByKey<Rest>
: []
: [];
type GetUnionColumnKey<T extends InterfaceArray[]> = ColumnKey extends keyof UnionColumn<T>
? UnionColumn<T>[ColumnKey]
: never;
export const columns: DataTableColumn[] = [
{
type: 'selection'
},
{
title: 'Name',
key: 'name',
align: 'center'
},
{
title: 'Age',
key: 'age'
},
{
title: 'Address',
key: 'address'
}
];
export type UnionColumnKey = GetUnionColumnKey<
ExcludeArrayByKey<
[
{
type: 'selection';
},
{
title: 'Name';
key: 'name';
align: 'center';
},
{
title: 'Age';
key: 'age';
},
{
title: 'Address';
key: 'address';
}
]
>
>;
// import type { DataTableColumn } from 'naive-ui';

View File

@ -1,5 +1,9 @@
import { ref } from 'vue';
/**
* boolean组合式函数
* @param initValue 初始值
*/
export default function useBoolean(initValue = false) {
const bool = ref(initValue);