async onLoad() { // console.log(111); console.log(this.indexA); if (this.indexA ==0) { console.log('终止请求数据'); return } if (this.searchList.length>=indexA) { console.log('终止请求数据'); console.log(this.searchList.length); this.finished =true return } const { data: { code, result: { songCount, songs }, }, } = await searchResult({ keywords: this.kw, //搜索接口的查询关键词 limit: this.limit, //每页请求的条数 offset: (this.pagenum - 1) * this.limit, }); // await 后面的代码都是请求完成后才会执行 console.log(songCount, songs); this.loading = false; // this.songs = asongs || []; //判断加载的数据是否大于 总共数据,大于 则停止赋值,并展示最新数据,不大于, const curList = [...this.searchList, ...(songs || [])]; this.searchList = curList; console.log("下拉加载数据", this.searchList.length); 此时inidex=300,为什么不会下拉一直处于加载 },
时间: 2024-04-28 11:20:13 浏览: 18
根据您提供的代码,我看到 onLoad 方法中有一些逻辑判断,其中包括对 indexA 和 searchList 数组的长度进行判断。在这个代码段中,当 indexA 为 0 或 searchList 数组长度已经大于等于 indexA 时,会终止请求数据并设置 finished 为 true。因此,如果您的 indexA 为 300,但是 searchList 数组已经达到或超过 300 时,就会停止加载数据。可以检查一下您的数据是否满足这些条件,如果不满足,可以尝试调整判断条件或检查其他可能的问题。
相关问题
// 分页 handleSizeChange(val) { this.pageSize = val this.handleNodeClick() }, handleCurrentChange(val) { this.page = val this.handleNodeClick() }, async getTreeListList() { const { data } = await businessTreeApi() this.departlist = JSON.parse(data.data) }, // 右侧上部分信息 async handleNodeClick(type) { console.log(type) if (type) { this.id = type.id } const List = (await businessApi(this.id)).data.data // this.datalist.agentId = type.id ? type.id : id // console.log(this.datalist) // const {data}= await courierPagingApi(this.datalist) // console.log(data); console.log(List) if (List.type === 1) { this.form.type = '一级转运中心' } else if (List.type === 2) { this.form.type = '二级转运中心' } else this.form.type = '营业部' this.form.number = List.id // v-model 数字 // this.form.type=List.type==3?'营业部':'', // 类型 this.form.name = List.name // 名字 this.form.region = List.province.name // 省 this.form.city = List.city.name // 城市 this.form.county = List.county.name // 县区 this.form.address = List.address // 详细地址 this.form.people = List.managerName // 负责人 this.form.phone = List.phone // 电话 this.form.longitude = List.longitude // 经度 this.form.latitude = List.latitude // 维度 // ------------------------------------ let obj = { page: this.page, pageSize: this.pageSize, agencyId: this.id } // 页码 const { data } = await getUserPageApi(obj) this.total = data.data.counts console.log(data.data) this.tableData = data.data.items this.total = Number(data.data.counts) // 下拉框数据 const res = await editAreasApi() console.log(res) this.economize = res.data.data if (this.value) { const ress = await editAreasApi(this.value) console.log(ress) } }, onSubmit() { this.isOk = !this.isOk } // 编辑数据 }
这段代码是关于一个树形结构的页面分页展示和编辑数据的处理,其中包括以下几个方法:
1. `handleSizeChange(val)`:处理每页展示数据量的变化,并调用`handleNodeClick()`方法重新渲染数据。
2. `handleCurrentChange(val)`:处理当前页码的变化,并调用`handleNodeClick()`方法重新渲染数据。
3. `getTreeListList()`:获取树形结构的数据,并将其解析为JSON格式。
4. `handleNodeClick(type)`:处理节点的点击事件,并根据节点类型展示对应的数据。同时,根据当前节点的ID,获取该节点下的用户数据,并展示在页面中。另外,还会获取下拉框数据。
5. `onSubmit()`:处理编辑数据的提交事件。
总体来说,这段代码实现了一个树形结构的页面展示和编辑数据的功能。
async function async1(){console.log("1"); await async2(); console.log("2")}
你好,我是CSDN开发的ChitGPT,是一个能够进行自然语言对话的AI程序。关于你的问题,这是一段JavaScript代码,定义了一个名为async1的异步函数,其中包含一些语句。当运行此函数时,首先会输出数字“1”,然后调用异步函数async2()并等待其完成,最后输出数字“2”。如果你有其他问题,欢迎随时向我提问。
相关推荐
![html](https://img-home.csdnimg.cn/images/20210720083451.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)