fix(接口文档): #1006735 【接口定义】接口列表,API-CASE-文档,互相切换时页面会报错

【【接口定义】接口列表,API-CASE-文档,互相切换时页面会报错】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006735
This commit is contained in:
song-tianyang 2021-09-17 18:29:04 +08:00 committed by 刘瑞斌
parent 296ecca115
commit 845d817a09
2 changed files with 10 additions and 3 deletions

View File

@ -665,7 +665,7 @@ export default {
this.$message.error(this.$t('api_report.error')); this.$message.error(this.$t('api_report.error'));
}, },
handleScroll(){ handleScroll(){
if(!this.clickStepFlag){ if(!this.clickStepFlag && this.$refs.apiDocInfoDiv){
//apiDocInfoDiv(item+20) //apiDocInfoDiv(item+20)
let apiDocDivScrollTop = 0; let apiDocDivScrollTop = 0;
if(this.$refs.apiDocInfoDiv&&this.$refs.apiDocInfoDiv.scrollTop){ if(this.$refs.apiDocInfoDiv&&this.$refs.apiDocInfoDiv.scrollTop){
@ -758,6 +758,9 @@ export default {
this.clickStepFlag = false; this.clickStepFlag = false;
}, },
redirectScroll(){ redirectScroll(){
if(!this.$refs.apiDocInfoDiv){
return;
}
//api //api
let apiDocDivClientTop = 0; let apiDocDivClientTop = 0;
let itemHeightCount = 0; let itemHeightCount = 0;

View File

@ -561,7 +561,9 @@ export default {
this.$message.error(this.$t('api_report.error')); this.$message.error(this.$t('api_report.error'));
}, },
handleScroll(){ handleScroll(){
if(!this.$refs.apiDocInfoDiv){
return;
}
//apiDocInfoDiv(item+20) //apiDocInfoDiv(item+20)
let apiDocDivScrollTop = this.$refs.apiDocInfoDiv.scrollTop; let apiDocDivScrollTop = this.$refs.apiDocInfoDiv.scrollTop;
let apiDocDivClientTop = this.$refs.apiDocInfoDiv.clientHeight; let apiDocDivClientTop = this.$refs.apiDocInfoDiv.clientHeight;
@ -591,7 +593,9 @@ export default {
let itemHeight = this.$refs.apiDocInfoDivItem[i].offsetHeight+20; let itemHeight = this.$refs.apiDocInfoDivItem[i].offsetHeight+20;
itemHeightCount+=itemHeight; itemHeightCount+=itemHeight;
} }
this.$refs.apiDocInfoDiv.scrollTop = (apiDocDivClientTop+itemHeightCount); if(this.$refs.apiDocInfoDiv){
this.$refs.apiDocInfoDiv.scrollTop = (apiDocDivClientTop+itemHeightCount);
}
}, },
checkApiInfoNode(itemIndex){ checkApiInfoNode(itemIndex){
//api3 //api3