1.请求返回的数据是Long类型,会导致数据丢失精度
const cloudAxios = axios.create({
baseURL: meta_cloud_server_host,
timeout: defaultTimeout,
headers: defaultHeaders,
transformResponse: (data) => {
if (typeof data === 'string') {
try {
const JSONBigString = require('json-bigint')({storeAsString: true});
data = JSONBigString.parse(data);
} catch (e) {
/* Ignore */
}
}
return data;
},
});
网友评论