使用epubjs渲染电子书失败解决办法

使用epubjs渲染电子书失败解决办法

使用如下代码渲染电子书时,无法渲染,之前能渲染,不知道后来为什么不能了,完全是按照官网的写的,但是就是渲染不出来,也没有任何报错信息,输出this.book  里面也没有任何关于书籍的信息,初步判断为解析电子书失败,因为network中已经加载了电子书。

this.book = new Epub("http://localhost:8888/opf/Biomedicine/111.epub")

// 将book渲染到 read 区域
this.rendition = this.book.renderTo('read', {
  width: window.innerWidth,
  height: window.innerHeight,
  methods: 'default'
})
this.rendition.display()

解决办法:

将111.epub改成111.zip解压,得到一个文件夹111,修改电子书地址,能够成功解析。

this.book = new Epub("http://localhost:8888/opf/Biomedicine/111/")

猜你喜欢

转载自blog.csdn.net/qq_16687863/article/details/106244272