为了账号安全,请及时绑定邮箱和手机立即绑定

vue3.0打包后打开dist中的index.html报下列错误

https://img1.sycdn.imooc.com//5ce545d10001981d07850053.jpg

百度了好久还是解决不了问题

Ebook.vue中代码:

const DOWNLOAD_URL = '/book.epub'
global.ePub = Epub
export default {
  methods: {
    // 根据链接跳转到指定目录
    jumpTo (href) {
      this.rendition.display(href)
      this.menuToggle()
    },
    // progress值为0-100
    onProgressChange (progress) {
      const precentage = progress / 100
      const location = precentage > 0 ? this.location.cfiFromPercentage(precentage) : 0
      this.rendition.display(location)
    },
    // 电子书解析和渲染
    showEpub () {
      // 生成Ebook
      this.book = new Epub(DOWNLOAD_URL)
      // 生成Rendition,通过Book.renderTo方法生成
      this.rendition = this.book.renderTo('read', {
        width: window.innerWidth,
        height: window.innerHeight
      })
      // 通过Rendition.display渲染电子书
      this.rendition.display()
      this.themes = this.rendition.themes
      this.changeFontSize(this.defaultFontSize)
      this.registerTheme()
      this.setTheme(this.defaultTheme)
      // 获取location对象来实现阅读进度功能
      this.book.ready.then(() => {
        this.navigation = this.book.navigation
        // console.log(all)
        // console.log(this.navigation)
        return this.book.locations.generate()
      }).then(result => {
        this.location = this.book.locations
        this.bookAvailable = true
      })
    }

vue.config.js中代码:

const path = require('path')

function resolve (dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  chainWebpack: (config) => {
    config.resolve.alias
      .set('src', resolve('src'))
      .set('styles', resolve('src/assets/styles'))
      .set('components', resolve('src/components'))
  },
  devServer: {
    host: '0.0.0.0',
    port: 8080
  },
  publicPath: './'
}

不知道哪里出了问题,求救!!!

正在回答

1 回答

您好,请问您这个问题解决了嘛,我也遇到这个问题了。。。项目着急上线,能回复一下嘛

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

vue3.0打包后打开dist中的index.html报下列错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信