到底是哪里有问题,图书一直渲染不出来

来源:3-2 电子书解析和渲染

远世4101394

2020-08-11 02:54

<template>  <div class="ebook">    <div class="read-wrapper">      <div id="read"></div>    </div>  </div></template><script>import Epub from 'epubjs'const DOWNLOAD_URL = '/static/2018_Book_AgileProcessesInSoftwareEngine.epub'global.ePub = Epubexport default {  components: {  },  methods: {    // 电子书的解析和渲染    showEpub () {      // 生成Book对象      this.book = new Epub(DOWNLOAD_URL)      // 通过Book.renderTo生成Rendition对象      this.rendition = this.book.renderTo('read', {        width: window.innerWidth,        height: window.innerHeight,        // 兼容iOS        method: 'default'      })      // 通过Rendtion.display渲染电子书      this.rendition.display()    }  },  mounted () {    this.showEpub()  }}</script><style lang='scss' scoped>@import 'assets/styles/global';</style>

http://img4.mukewang.com/5f3197be000142ed02610659.jpg

http://img2.mukewang.com/5f3197be000129e017630824.jpg


写回答 关注

3回答

  • qq_慕娘6440075
    2020-08-29 22:32:37
    已采纳

    我也是在别的回答里面看到别人回复的,试了可以用,你把这个const DOWNLOAD_URL = '/static/2018_Book_AgileProcessesInSoftwareEngine.epub'

    换成

    const DOWNLOAD_URL = '/2018_Book_AgileProcessesInSoftwareEngine.epub'

  • 慕婉清2346521
    2021-04-26 16:14:25

    我路径改为我服务器上的资源报跨越怎么办

  • qq_慕村0444645
    2020-10-24 19:59:34

    这个路径要用网络路径,可以用vscode插件live serve,新创个项目,新建文件夹,把书上放进去,启动live serve,用这个本地网络路径

快速入门Web阅读器开发

带你了解电子书阅读器的工作原理,通过Vue.js快速实现Web阅读器

26238 学习 · 214 问题

查看课程

相似问题