fix(接口测试): 修复推荐提取数字显示精确度错误问题
--bug=1009465 --user=赵勇 [github#9090]JSONPath提取器数据精度丢失 https://www.tapd.cn/55049933/s/1090126
This commit is contained in:
parent
09a4129dd6
commit
9d085402f1
|
@ -125,6 +125,7 @@ export default {
|
||||||
this.fullTreeNodes = [];
|
this.fullTreeNodes = [];
|
||||||
this.failsTreeNodes = [];
|
this.failsTreeNodes = [];
|
||||||
this.isRequestResult = false;
|
this.isRequestResult = false;
|
||||||
|
this.activeName = "total";
|
||||||
},
|
},
|
||||||
handleClick(tab, event) {
|
handleClick(tab, event) {
|
||||||
this.isRequestResult = false;
|
this.isRequestResult = false;
|
||||||
|
|
|
@ -28,11 +28,13 @@ const clickoutside = {
|
||||||
binding.value(e)
|
binding.value(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
|
// 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
|
||||||
el.__vueClickOutside__ = documentHandler
|
el.__vueClickOutside__ = documentHandler
|
||||||
document.addEventListener('click', documentHandler)
|
document.addEventListener('click', documentHandler)
|
||||||
},
|
},
|
||||||
update () { },
|
update() {
|
||||||
|
},
|
||||||
unbind(el, binding) {
|
unbind(el, binding) {
|
||||||
// 解除事件监听
|
// 解除事件监听
|
||||||
document.removeEventListener('click', el.__vueClickOutside__)
|
document.removeEventListener('click', el.__vueClickOutside__)
|
||||||
|
@ -67,9 +69,8 @@ export default {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
try {
|
try {
|
||||||
// 解决精度丢失问题
|
// 解决精度丢失问题
|
||||||
// let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"');
|
let JSONBig = require('json-bigint')({"storeAsString": true});
|
||||||
// 一些情况会解析失败,先注释掉
|
let param = JSON.parse(JSON.stringify(JSONBig.parse(objStr)));
|
||||||
let param = JSON.parse(objStr);
|
|
||||||
if (param instanceof Array) {
|
if (param instanceof Array) {
|
||||||
this.$warning('不支持解析JSON数组');
|
this.$warning('不支持解析JSON数组');
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue