Commit aabe0d5c authored by wangjiankun's avatar wangjiankun

ppt pdf word 页数显示不正确问题

parent 61b7a5d8
...@@ -85,7 +85,8 @@ export default { ...@@ -85,7 +85,8 @@ export default {
fullState: false, fullState: false,
loading: false, loading: false,
loadTask: '', loadTask: '',
toolBarShow: false toolBarShow: false,
saveMaxHeight: 0
} }
}, },
watch: { watch: {
...@@ -186,8 +187,13 @@ export default { ...@@ -186,8 +187,13 @@ export default {
$('.tool-bar').css('display', 'none') $('.tool-bar').css('display', 'none')
this.toolBarShow = false this.toolBarShow = false
} }
const itemHeight = $($('.pdfItem')[0]).outerHeight(true), // $('.pdfList').height()/this.numPages; let itemHeight = 0
scrolled = $('.pdf')[0].scrollTop $('.pdfItem').each(function() {
const h = $(this).outerHeight()
itemHeight = itemHeight < h ? h : itemHeight
})
// $('.pdfList').height()/this.numPages;
const scrolled = $('.pdf')[0].scrollTop
this.page = parseInt((scrolled + itemHeight) / (itemHeight)) + Math.ceil($('.pdf').height() / itemHeight) - 1 this.page = parseInt((scrolled + itemHeight) / (itemHeight)) + Math.ceil($('.pdf').height() / itemHeight) - 1
}, },
toFullScreen() { toFullScreen() {
......
...@@ -188,9 +188,13 @@ export default { ...@@ -188,9 +188,13 @@ export default {
$('.tool-bar').css('display', 'none') $('.tool-bar').css('display', 'none')
this.toolBarShow = false this.toolBarShow = false
} }
const itemHeight = $('.pdfItem').height(), // $('.pdfList').height()/this.numPages; let itemHeight = 0
scrolled = $('.pdf')[0].scrollTop $('.pdfItem').each(function() {
console.log($('.pdf')[0].scrollTop, $('.pdfItem').height()) const h = $(this).outerHeight()
itemHeight = itemHeight < h ? h : itemHeight
})
// $('.pdfList').height()/this.numPages;
const scrolled = $('.pdf')[0].scrollTop
this.page = parseInt((scrolled + itemHeight) / (itemHeight)) + parseInt($('.pdf').height() / itemHeight) - 1 this.page = parseInt((scrolled + itemHeight) / (itemHeight)) + parseInt($('.pdf').height() / itemHeight) - 1
}, },
toFullScreen() { toFullScreen() {
......
...@@ -186,10 +186,14 @@ export default { ...@@ -186,10 +186,14 @@ export default {
$('.tool-bar').css('display', 'none') $('.tool-bar').css('display', 'none')
this.toolBarShow = false this.toolBarShow = false
} }
const itemHeight = $('.pdfItem').outerHeight(true), // $('.pdfList').height()/this.numPages; let itemHeight = 0
scrolled = $('.pdf')[0].scrollTop $('.pdfItem').each(function() {
const h = $(this).outerHeight()
itemHeight = itemHeight < h ? h : itemHeight
})
// $('.pdfList').height()/this.numPages;
const scrolled = $('.pdf')[0].scrollTop
this.page = parseInt((scrolled + itemHeight) / (itemHeight)) + Math.ceil($('.pdf').height() / itemHeight) - 1 this.page = parseInt((scrolled + itemHeight) / (itemHeight)) + Math.ceil($('.pdf').height() / itemHeight) - 1
console.log((scrolled + itemHeight), itemHeight, Math.ceil($('.pdf').height() / itemHeight))
}, },
toFullScreen() { toFullScreen() {
const that = this const that = this
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment