|
@@ -14,13 +14,17 @@ export function useTableRowSelect<T extends Record<string, unknown>>(
|
|
|
|
|
|
const selectId = useMemo(function() {
|
|
|
const result: string[] = [];
|
|
|
-
|
|
|
for (const [key, value] of Object.entries(rowSelection)) {
|
|
|
- if (value) {
|
|
|
- // key返回的对应的数组索引
|
|
|
- const id = data[Number(key)][rawKey ?? 'id'] as string;
|
|
|
+ // 防止有subComponent时key值获取异常(eg. 1_nosub)
|
|
|
+ try {
|
|
|
+ if (value) {
|
|
|
+ // key返回的对应的数组索引
|
|
|
+ const id = data[Number(key)][rawKey ?? 'id'] as string;
|
|
|
|
|
|
- result.push(id);
|
|
|
+ result.push(id);
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
|