mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 添加请求适配adapter层应用的示例页面
This commit is contained in:
@ -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';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
/**
|
||||
* boolean组合式函数
|
||||
* @param initValue 初始值
|
||||
*/
|
||||
export default function useBoolean(initValue = false) {
|
||||
const bool = ref(initValue);
|
||||
|
||||
|
Reference in New Issue
Block a user