我需要从epub文件中除以spine项目的html标签获取内容,然后在所见即所得编辑器中对其进行渲染。
我还尝试从脊柱项目中的方法加载中加载内容。
示例代码
import ePub from "epubjs";
const book = ePub(blob);
book.loaded.spine.then((spine) => {
spine.each((item) => {
item.load().then((contents) => {
console.log(contents);
});
});
});
结果
section.js?9b61:55 Uncaught (in promise) TypeError: request is not a function
at Section.load (section.js?9b61:55)
at eval (VM7198 Step1.vue:222)
at Array.forEach (<anonymous>)
at Spine.each (spine.js?4641:215)
at eval (VM7198 Step1.vue:220)
我还尝试从dist文件夹导入lib
import ePub from "epubjs/dist/epub";
导致404错误(localhost:3000 / EPUB / cover.xhtml)。
对此有何想法?