Skip to content

Commit 34e5b3c

Browse files
committed
types: 💡 tsc error
1 parent e88fcc8 commit 34e5b3c

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "xsadmin",
2+
"name": "vue-xs-admin",
33
"version": "1.6.1",
4+
"packageManager": "[email protected]",
45
"author": {
56
"name": "小斯斯",
67
"email": "[email protected]",
78
"url": "https://github.com/SuperCuteXiaoSi"
89
},
910
"license": "MIT",
10-
"packageManager": "[email protected]",
1111
"engines": {
1212
"node": ">=16",
1313
"pnpm": ">=8.1.0"

src/components/Table/index.vue

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@
22
import type { PropType } from 'vue';
33
import TableChild from './src/components/TableChild.vue';
44
defineProps({
5-
attribute: {
6-
type: Object as PropType<Recordable>,
7-
default: () => {},
5+
data: {
6+
type: Array as PropType<Recordable[]>,
7+
default: () => {
8+
return [];
9+
},
810
},
911
option: {
1012
type: Object as PropType<Recordable>,
1113
default: () => {},
1214
},
15+
border: {
16+
type: Boolean,
17+
default: false,
18+
},
1319
});
1420
</script>
1521

1622
<template>
1723
<div>
18-
<el-table v-bind="$attrs" style="width: 100%">
24+
<el-table v-bind="$attrs" :data="data" :border="border" style="width: 100%">
1925
<TableChild v-for="(item, index) in option" :key="index" :item="item">
20-
<template v-for="soitem in Object.keys($slots)" #[soitem]="data">
21-
<slot :name="soitem" v-bind="((data || {}) as Recordable)"></slot>
26+
<template v-for="soitem in Object.keys($slots)" #[soitem]="_data">
27+
<slot :name="soitem" v-bind="((_data || {}) as Recordable)"></slot>
2228
</template>
2329
</TableChild>
2430
</el-table>

src/views/useradmin/async-component/component/ToModal.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
import { ref } from 'vue';
33
import Table from '@/components/Table/index.vue';
44
5-
const data = () => {
5+
interface TableList {
6+
date: string;
7+
name: string;
8+
address: string;
9+
}
10+
11+
const data = (): Promise<TableList[]> => {
612
return new Promise((resolve) => {
713
setTimeout(() => {
814
resolve([
@@ -32,7 +38,7 @@
3238
};
3339
3440
const res = await data();
35-
const tabList = ref(res);
41+
const tabList = ref<TableList[]>(res);
3642
3743
const option = [
3844
{

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"allowSyntheticDefaultImports": true,
1313
"strictFunctionTypes": false,
1414
"jsx": "preserve",
15-
"baseUrl": ".",
15+
"baseUrl": "./",
1616
"allowJs": false,
1717
"sourceMap": true,
1818
"esModuleInterop": true,
1919
"resolveJsonModule": true,
20-
"incremental": true,
20+
"incremental": false,
2121
"noUnusedLocals": true,
2222
"noUnusedParameters": true,
2323
"experimentalDecorators": true,

tsconfig.node.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"composite": true,
44
"module": "ESNext",
55
"moduleResolution": "Node",
6+
"baseUrl": "./",
67
"allowSyntheticDefaultImports": true,
78
"types": ["vite/client"]
89
},

0 commit comments

Comments
 (0)