请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

touchstart 和 touchend不生效

touchstart 和 touchend不生效

  1. epubjs 已经降低至0.3.71 版本
  2. 开始chrome 手机调试模式

正在回答

5回答

Sam 2019-01-27 23:44:33

你好,已经调试过你的源码,源码没有问题,问题还是出在epubjs没有降级,注意要修改package.json,将epubjs改为:

"epubjs": "0.3.71"

然后重新执行npm install,之后再运行,问题解决,已经在chrome浏览器下进行测试,可以运行

1 回复 有任何疑惑可以回复我~
  • 降级失败,
    执行 nom install 后,再运行显示
    Failed to resolve loader: sass-loader
    You may need to install it.
    Failed to resolve loader: sass-loader
    You may need to install it.
    回复 有任何疑惑可以回复我~ 2019-05-03 11:59:51
  • Sam 回复 宝慕林1444926 #2
    根据提示应该是sass-loader没有安装:npm install sass-loader -D
    回复 有任何疑惑可以回复我~ 2019-05-03 13:11:28
提问者 wxw730 2019-01-27 17:16:09
<template>
<div class="ebook-reader">
<div id="read">
<button @click="prev">aaa</button>
<button @click="next">bbb</button>
</div>
</div>
</template>
<script>
import Epub from 'epubjs'
import { mapGetters } from 'vuex'
global.ePub = Epub
export default {
computed: {
...mapGetters(['fileName'])
},
methods: {
prev() {
this.rendition.prev()
},
next() {
this.rendition.next()
},
initEpub() {
const url = 'http://192.168.0.101:4399/' + this.fileName + '.epub'
this.book = new Epub(url)
this.rendition = this.book.renderTo('read', {
width: innerWidth,
height: innerHeight,
method: 'default'
})
this.rendition.display()
console.log(this.rendition)
this.rendition.on('touchstart', e => {
console.log(e)
})
this.rendition.on('touchend', event => {
console.log(event)
})
}
},
mounted() {
this.$store
.dispatch('setFilename', this.$route.params.fileName.split('|').join('/'))
.then(() => {
this.initEpub()
})
}
}
</script>
<style lang="scss" scoped>
</style>


0 回复 有任何疑惑可以回复我~
  • 提问者 wxw730 #1
    reader 组件的源码
    回复 有任何疑惑可以回复我~ 2019-01-27 17:16:30
提问者 wxw730 2019-01-27 17:14:49

 =.=

0 回复 有任何疑惑可以回复我~
提问者 wxw730 2019-01-27 16:37:33

请问码云地址可以吗?慕课没找到上传文件的 https://gitee.com/wxw730/wxw-book 

0 回复 有任何疑惑可以回复我~
Sam 2019-01-27 16:23:57

你好,请打包源码上传,我调试一下

0 回复 有任何疑惑可以回复我~
  • 提问者 wxw730 #1
    this.rendition.next() 和  this.rendition.prev() 都没问题 就是滑动事件不起作用。。
    chrome 报这个错误 [Violation] Avoid using document.write().
    回复 有任何疑惑可以回复我~ 2019-01-27 17:03:00
  • 提问者 wxw730 #2
    用手机调试可以。。chrome就不行 这是什么原因?
    回复 有任何疑惑可以回复我~ 2019-01-27 17:39:55
  • Sam 回复 提问者 wxw730 #3
    chrome切到手机模式,因为pc模式下不支持touch事件
    回复 有任何疑惑可以回复我~ 2019-05-03 13:10:25
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信