pdf搜索优化

This commit is contained in:
cwchen 2025-11-27 18:48:02 +08:00
parent ed03901ba8
commit 775210ba49
1 changed files with 5 additions and 20 deletions

View File

@ -823,30 +823,16 @@ export default {
if (!target) return
const wrapper = this.$refs.pdfWrapper
if (!wrapper) return
const container = target.closest('.pdf-page') || target
if (!container) return
// pdf-page
if (!useSmoothScroll) {
//
try {
target.scrollIntoView({
behavior: 'auto',
block: 'center',
inline: 'nearest',
})
} catch (e) {
//
const container = target.closest('.pdf-page') || target
if (!container) return
const wrapperOffsetTop = container.offsetTop
const containerHeight = container.offsetHeight || target.offsetHeight || 0
const desired = wrapperOffsetTop - Math.max((wrapper.clientHeight - containerHeight) / 2, 0)
this.cancelScrollAnimation()
wrapper.scrollTop = desired
}
this.cancelScrollAnimation()
wrapper.scrollTop = container.offsetTop
return
}
const container = target.closest('.pdf-page') || target
if (!container) return
const wrapperOffsetTop = container.offsetTop
const containerHeight = container.offsetHeight || target.offsetHeight || 0
const desired = wrapperOffsetTop - Math.max((wrapper.clientHeight - containerHeight) / 2, 0)
@ -1369,7 +1355,6 @@ export default {
padding: 24px;
background: #eaeaea;
position: relative;
scroll-behavior: smooth;
overscroll-behavior: contain;
scrollbar-gutter: stable both-edges;
-webkit-overflow-scrolling: touch;