0
点赞
收藏
分享

微信扫一扫

前端如何查看后端返回的数据有没有重复的?

我不知道怎么用postman之类的工具怎么测试重复,一个个找眼花,用了一个笨方法,来查看查重数据

准备工具:word,chrome浏览器

技术:for console.log()


一:把得到的数据循环用console.log打印出来。

二:word新建一个文档(id数字类用execel,name类文字用word):


例如:

我打印了其中数组对象中的storeName文字属性值,如果storeName一样就去看接口返回的数据到底重复了没

data() {
return {this.storeList = [],//请求数据}
}

methods: {
getStoreList:function () {
this.request(api...).then(res => {//调用api接口
if (res.data.data.rows) {
this.storeList = this.storeList.concat(res.data.data.rows);

for (var i = 0; i < this.storeList.length; i++) {
console.log(this.storeList[i].storeName);//循环打印数据中的storeName值
}
}
}).catch((err) => {console.log("err: ", JSON.stringify(err));})
}

chrome浏览器在控制台把console.log的值复制,新建一个word文档粘贴进去,点击排序默认是拼音,点击确定 (突然发现可以选类型)

前端如何查看后端返回的数据有没有重复的?_for

前端如何查看后端返回的数据有没有重复的?_数据_02


有重复的storeName会排在一起,一目了然

前端如何查看后端返回的数据有没有重复的?_for_03

可以去接口返回具体的数据按照顺序去找

前端如何查看后端返回的数据有没有重复的?_chrome浏览器_04

举报

相关推荐

0 条评论