diff --git a/components/readers/PdfReader.vue b/components/readers/PdfReader.vue
index 6894083a..88544c7c 100644
--- a/components/readers/PdfReader.vue
+++ b/components/readers/PdfReader.vue
@@ -14,7 +14,7 @@
{{ Math.floor(loadedRatio * 100) }}%
-
+
@@ -48,7 +48,8 @@ export default {
page: 1,
numPages: 0,
windowWidth: 0,
- windowHeight: 0
+ windowHeight: 0,
+ pdfDocInitParams: null
}
},
computed: {
@@ -106,14 +107,6 @@ export default {
if (!this.userItemProgress?.ebookLocation || isNaN(this.userItemProgress.ebookLocation)) return 0
return Number(this.userItemProgress.ebookLocation)
},
- pdfDocInitParams() {
- return {
- url: this.url,
- httpHeaders: {
- Authorization: `Bearer ${this.userToken}`
- }
- }
- },
isPlayerOpen() {
return this.$store.getters['getIsPlayerOpen']
}
@@ -157,6 +150,8 @@ export default {
}
},
numPagesLoaded(e) {
+ if (!e) return
+
this.numPages = e
},
prev() {
@@ -175,6 +170,14 @@ export default {
screenOrientationChange() {
this.windowWidth = window.innerWidth
this.windowHeight = window.innerHeight
+ },
+ init() {
+ this.pdfDocInitParams = {
+ url: this.url,
+ httpHeaders: {
+ Authorization: `Bearer ${this.userToken}`
+ }
+ }
}
},
mounted() {
@@ -188,6 +191,8 @@ export default {
document.addEventListener('orientationchange', this.screenOrientationChange)
}
window.addEventListener('resize', this.screenOrientationChange)
+
+ this.init()
},
beforeDestroy() {
if (screen.orientation) {
@@ -199,4 +204,4 @@ export default {
window.removeEventListener('resize', this.screenOrientationChange)
}
}
-
\ No newline at end of file
+