mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-11 20:06:52 +08:00
feat(RenderMinerU): 实现代码视图滚动同步
- 添加 handleScroll 方法处理滚动事件 - 在 created 钩子中注释掉设置滚动事件监听的代码 - 优化了代码视图滚动时的同步逻辑
This commit is contained in:
@@ -575,6 +575,31 @@ ${text}`
|
|||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message.error('重试操作失败')
|
this.$message.error('重试操作失败')
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理滚动事件
|
||||||
|
handleScroll() {
|
||||||
|
let viewBody = this.$refs.viewBody
|
||||||
|
let viewCodes = this.$refs.viewBody.querySelectorAll('view-code')
|
||||||
|
if (this.tab === '1') {
|
||||||
|
viewBody = this.$refs.mdEditor
|
||||||
|
viewCodes = this.$refs.mdEditor.querySelectorAll('ebiz-code')
|
||||||
|
}
|
||||||
|
const viewBodyTop = viewBody.scrollTop
|
||||||
|
const viewBodyHeight = viewBody.clientHeight
|
||||||
|
let currentPage = this.page
|
||||||
|
for (let i = 0; i < viewCodes.length; i++) {
|
||||||
|
const viewCode = viewCodes[i]
|
||||||
|
const viewCodeTop = viewCode.offsetTop
|
||||||
|
if (viewCodeTop >= viewBodyTop && viewCodeTop < viewBodyTop + viewBodyHeight / 2) {
|
||||||
|
currentPage = i + 1
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentPage !== this.page) {
|
||||||
|
this.page = currentPage
|
||||||
|
this.sendMessageToIframe('setPage', currentPage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
@@ -606,6 +631,9 @@ ${text}`
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.generateTableButtons()
|
this.generateTableButtons()
|
||||||
|
//
|
||||||
|
// this.$refs.viewBody.onscroll = this.handleScroll
|
||||||
|
// this.$refs.mdEditor.onscroll = this.handleScroll
|
||||||
},
|
},
|
||||||
computed: {}
|
computed: {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default {
|
|||||||
name: 'create',
|
name: 'create',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: true,
|
visible: false,
|
||||||
active: 0,
|
active: 0,
|
||||||
documentId: '1363864715567140864'
|
documentId: '1363864715567140864'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user