Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教:playing()方法没有实现,或者是如何调用的; #40

Closed
lancerAcher opened this issue Jul 12, 2021 · 9 comments
Closed

Comments

@lancerAcher
Copy link

我要是实现的功能是类似于歌词滚动效果的,所以需要playing()播放中触发事件。我目前没有看懂作者你 playing()方法的调用方式

@1014156094
Copy link
Owner

1014156094 commented Jul 12, 2021

我有 emitplaying 事件,你标签可以加上 @playing="",文档有写的

@lancerAcher
Copy link
Author

解决了,谢谢您,我字父组件通信方法写错了。

@lancerAcher
Copy link
Author

在单页面创建vue实例,如果通过引用组件的方法,如何实现?通过vue的组件
components: {
AudioPlayer:httpVueLoader('./@liripeng/vue-audio-player')
},
发现路径不是很对,

@1014156094
Copy link
Owner

是main.js里面,还是vue文件里面

@1014156094
Copy link
Owner

image

@lancerAcher
Copy link
Author

lancerAcher commented Jul 12, 2021

html 页面 单页面注册vue实例,无法进行组件注册。
`

<script src="https://static.quhouse.com/zkgj/js/vue.min.js"></script> <script src="https://unpkg.com/vue"></script> <script src="https://unpkg.com/http-vue-loader"></script> <title>Document</title>
<script> var app = new Vue({ el: '#app', data() { return { audioList: [ { name: '音频1', url: 'https://static.quhouse.com/audio/d7879fbcdfcc436189ce79e643e0aeb8.mp3' } ] } }, mounted() {}, components: { AudioPlayer:httpVueLoader('./@liripeng/vue-audio-player') }, methods: { handleBeforePlay(next) { console.log('我要开始播放了')
        next() // 开始播放
		
      },
	 playing(e){
	 	console.log("我播放中",this.$refs.audioPlayer.currentTime)
		
	 }
	}
})
</script> `

@1014156094
Copy link
Owner

1014156094 commented Jul 12, 2021

你没用webpack和npm吗

@1014156094
Copy link
Owner

1014156094 commented Jul 12, 2021

image

如果你没用 npm 的话,你下载 fonts.jsaudio-player/index.vue 下来,引入到 HTML 里面应该就可以了,我现在不支持 HTML 方式引入,后面我可能加入这功能。

例如:
httpVueLoader('./audio-player/index.vue')

@1014156094
Copy link
Owner

突然想起来可以这样,下载 packages 目录下来,引入 index.js

// 以下路径需根据项目实际情况填写
import VueAudioPlayer from '../../js/vue-audio-player/index.js'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants