- 请大神回复?
为什么报错? [图片]
2021-12-21 - index组件中的js以及wxss文件改为全局样式?
出现:Component "pages/index/index" does not have a method "play" to handle event "tap". <view class="player player-{{isPlayingMusic ? 'play' : 'pause'}}" bindtap="play"> <image src="/images/6.jpeg"/> <image src="/images/7.jpeg"/> </view> <image class="bg-image" mode="scaleToFill" src="/images/9.jpeg"/> <view class="content"> <view class="content-title">邀请函</view> <view class="container"> <view class="content-address"> <view>我们诚邀您来参加元旦晚会</view> <view>时间:2021年12月15日</view> <view>地点:广东科技学院</view> </view> <view class="x"> <open-data type="userAvatarUrl"></open-data> </view> <open-data type="userNickName"></open-data> </view> </view> bindtap="play"应该改为什么?
2021-12-16 - js中出现 Cannot read property 'play' of nul?
请大神回复: const app = getApp() Page({ data:{ isPlayingMusic:false, }, bgm:null, music_url:'/images/易言 - 太阳.mp3', music_coverImgUrl:'/images/50.jpg', OnReady:function(){ this.bgm = wx.getBackgroundAudioManager() this.bgm.title='太阳' this.bgm.epname='abc' this.bgm.singer='易言' this.bgm.coverImgUrl = this.music_coverImgUrl this.bgm.onCanplay(()=>{ this.bgm.pause() }) this.bgm.src = this.music_url }, play:function(){ if(this.data.isPlayingMusic){ this.bgm.pause() }else{ this.bgm.play() } this.setData({ isPlayingMusic: ! this.data.isPlayingMusic }) } })
2021-12-15