fix(接口测试): 断言表格排序
This commit is contained in:
parent
3eaeb27630
commit
c87ff4cb74
|
@ -143,11 +143,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSortChange(sorter: { [key: string]: string }) {
|
function handleSortChange(sorter: { [key: string]: string }) {
|
||||||
const dataIndex = Object.keys(sorter)[0] as keyof ResponseAssertionTableItem;
|
if (Object.keys(sorter).length > 0) {
|
||||||
tableData.value = tableData.value?.sort((a, b) => {
|
const dataIndex = Object.keys(sorter)[0] as keyof ResponseAssertionTableItem;
|
||||||
const sortResult = a[dataIndex] > b[dataIndex] ? -1 : 1;
|
const copyArray = [...(props.requestResult?.responseResult.assertions || [])];
|
||||||
return sorter[dataIndex] === 'asc' ? sortResult : -sortResult;
|
tableData.value = copyArray.sort((a, b) => {
|
||||||
});
|
const sortResult = a[dataIndex] > b[dataIndex] ? -1 : 1;
|
||||||
|
return sorter[dataIndex] === 'asc' ? sortResult : -sortResult;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
tableData.value = props.requestResult?.responseResult.assertions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue