彭小呆
2018-10-23 17:52
翻页是翻了,可是有个问题,每次翻页直接到下一章节了,很奇怪。
import Epub from 'epubjs'
const DOWNLOAD_URL = '/static/kill-a-bird.epub'
export default {
name: 'Ebook',
methods: {
prevPage () {
if (this.rendition) {
this.rendition.prev()
}
},
nextPage () {
if (this.rendition) {
this.rendition.next()
}
},
// 电子书的解析和渲染
showEpub () {
// 生成Book
this.book = new Epub(DOWNLOAD_URL)
console.log(this.book)
// 生成Rendition,通过Book.renderTo
this.rendition = this.book.renderTo('read', {
width: window.innerWidth,
height: window.innerHeight
})
// 通过Rendition.display
this.rendition.display()
}
},
mounted () {
this.showEpub()
}
}
你好,源码中没有看出问题,可以提供完整源码看下
快速入门Web阅读器开发
26533 学习 · 228 问题
相似问题