电子书渲染不出来
来源:2-8 vue-cli 3.0搭建方法(脚手架创建项目)
qq_分享_03220023
2019-05-21
Home.vue
<template>
<div class="home">
<div id="read"></div>
</div>
</template>
<script>
import Epub from 'epubjs'
global.ePub = Epub
export default {
name: 'home',
mounted () {
this.book = new Epub('/2010_Book_AccountabilityInPublicPolicyPa.epub')
console.log(this.book)
this.book.renderTo('read', {
width: window.innerWidth,
height: window.innerHeight
}).display()
}
}
</script>
但是浏览器可以打印出this.book
写回答
1回答
-
Sam
2019-05-21
你好,应该是电子书路径的问题,你在public目录下放置电子书了吗,如果放置了,把
this.book = new Epub('/2010_Book_AccountabilityInPublicPolicyPa.epub')
改为
this.book = new Epub('2010_Book_AccountabilityInPublicPolicyPa.epub')
试试
142020-05-04
相似问题