1、解决歌词不断跳动:实际上就是清空lyric中的timer计时器
**if (this.currentLyric) {
this.currentLyric.stop()
}**
2、解决歌词和音乐同步播放:
this.setPlayingState(!this.playing)
if (this.currentLyric) {
this.currentLyric.togglePlay()
}
3、解决循环播放不会到一开始的问题,在loop的代码如下:
if (this.currentLyric) {
this.currentLyric.seek(0)
}
4、拖动bar的时候,歌词跟着滚动:
5、播放页歌词的实现:
添加dom
<div class="playing-lyric-wrapper">
<div class="playing-lyric">{{playingLyric}}</div>
</div>
维护一个playLric
然后:在lyric回调的时候设置playingLric