vue中预览epub文件

1. 引入epubjs

        yarn add epubjs

2. 页面中引入:

        import ePub from 'epubjs'

3. 页面中目录和显示的div的代码

        


                

4. 具体实现代码:

  this.book = ePub(epubUrl);

  this.rendition=this.book.renderTo("viewer", { // // 滚动模式
            width: 860,
            height:560,
            flow: "scrolled",
            allowScriptedContent: true,
   });

   this.book.ready.then(() => {
   this.toc = this.book.navigation.toc;
   this.rendition.display();
 });

你可能感兴趣的:(前端,vue.js,javascript)