diff --git a/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue b/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue index fdef1192c9..5aaec3d253 100644 --- a/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue +++ b/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue @@ -665,7 +665,7 @@ export default { this.$message.error(this.$t('api_report.error')); }, handleScroll(){ - if(!this.clickStepFlag){ + if(!this.clickStepFlag && this.$refs.apiDocInfoDiv){ //apiDocInfoDiv的总高度,是(每个item的高度+20)数量 let apiDocDivScrollTop = 0; if(this.$refs.apiDocInfoDiv&&this.$refs.apiDocInfoDiv.scrollTop){ @@ -758,6 +758,9 @@ export default { this.clickStepFlag = false; }, redirectScroll(){ + if(!this.$refs.apiDocInfoDiv){ + return; + } //滚动条跳转:将滚动条下拉到显示对应对api接口的位置 let apiDocDivClientTop = 0; let itemHeightCount = 0; diff --git a/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue b/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue index 4e6a53c0e3..d60b718e8d 100644 --- a/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue +++ b/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue @@ -561,7 +561,9 @@ export default { this.$message.error(this.$t('api_report.error')); }, handleScroll(){ - + if(!this.$refs.apiDocInfoDiv){ + return; + } //apiDocInfoDiv的总高度,是(每个item的高度+20)数量 let apiDocDivScrollTop = this.$refs.apiDocInfoDiv.scrollTop; let apiDocDivClientTop = this.$refs.apiDocInfoDiv.clientHeight; @@ -591,7 +593,9 @@ export default { let itemHeight = this.$refs.apiDocInfoDivItem[i].offsetHeight+20; itemHeightCount+=itemHeight; } - this.$refs.apiDocInfoDiv.scrollTop = (apiDocDivClientTop+itemHeightCount); + if(this.$refs.apiDocInfoDiv){ + this.$refs.apiDocInfoDiv.scrollTop = (apiDocDivClientTop+itemHeightCount); + } }, checkApiInfoNode(itemIndex){ //检查要展示的api信息节点,和上下个3个及以内的范围内数据有没有查询过