老师,在attached里面this._recoverStatus()是不是多写了一遍呢

来源:10-13 真实感受Component与Model的好处

爱偷懒的小码农

2018-12-10

写回答

1回答

negrochn

2018-12-10

并没有呀,

你是想说,this._monitorSwitch()中已经有mMgr.onPlay(() => {this._recoverStatus()})了?


你可以把this._recoverStatus()注释了,然后播放,切换nav,然后切换回来看下,音乐实际是播放的,但图标变为pause了,


所以此处的this._recoverStatus()是用来控制切换nav时的播放图标状态的。

attached (e) {

this._recoverStatus()

this._monitorSwitch()

},



_monitorSwitch () {

mMgr.onPlay(() => {

this._recoverStatus()

})

mMgr.onPause(() => {

this._recoverStatus()

})

mMgr.onStop(() => {

this._recoverStatus()

})

mMgr.onEnded(() => {

this._recoverStatus()

})

}




0
1
爱偷懒的小码农
嗯嗯,的确是这样,谢谢啦
2018-12-10
共1条回复

纯正商业级微信小程序应用实战,全方位小程序特性讲解

真实数据的高质量小程序项目,学会直接工作

4782 学习 · 2125 问题

查看课程