fix: json-bigint parse used in vxeTable (#6271)
* 修复vxeTable不能加载json-bigint解析的数据的问题
This commit is contained in:
parent
af186f878d
commit
e5c937396d
@ -12,6 +12,7 @@ import {
|
|||||||
RequestClient,
|
RequestClient,
|
||||||
} from '@vben/request';
|
} from '@vben/request';
|
||||||
import { useAccessStore } from '@vben/stores';
|
import { useAccessStore } from '@vben/stores';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import JSONBigInt from 'json-bigint';
|
import JSONBigInt from 'json-bigint';
|
||||||
@ -29,7 +30,9 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
|||||||
transformResponse: (data: any, header: AxiosResponseHeaders) => {
|
transformResponse: (data: any, header: AxiosResponseHeaders) => {
|
||||||
// storeAsString指示将BigInt存储为字符串,设为false则会存储为内置的BigInt类型
|
// storeAsString指示将BigInt存储为字符串,设为false则会存储为内置的BigInt类型
|
||||||
return header.getContentType()?.toString().includes('application/json')
|
return header.getContentType()?.toString().includes('application/json')
|
||||||
? JSONBigInt({ storeAsString: true }).parse(data)
|
? cloneDeep(
|
||||||
|
JSONBigInt({ storeAsString: true, strict: true }).parse(data),
|
||||||
|
)
|
||||||
: data;
|
: data;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user