From c6c73b7d709322052b9cd6777b3d6657e0d43d30 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期六, 07 九月 2024 14:37:32 +0800 Subject: [PATCH] bug --- packageBookService/pages/bookServices/examination/questionList/index.js | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packageBookService/pages/bookServices/examination/questionList/index.js b/packageBookService/pages/bookServices/examination/questionList/index.js index 2b484c8..17e96ec 100644 --- a/packageBookService/pages/bookServices/examination/questionList/index.js +++ b/packageBookService/pages/bookServices/examination/questionList/index.js @@ -1,4 +1,7 @@ // pages/bookServices/examination/questionList/index.js +const innerAudioContext = wx.createInnerAudioContext({ + useWebAudioImplement: false +}) Component({ /** * 缁勪欢鐨勫睘鎬у垪琛� @@ -26,15 +29,18 @@ }, sliderValue: { type: Number, + }, + noData: { + type: Boolean, } }, - observers: { - 'questionList': function (newValue) { - console.log(newValue); + observers: {}, + detached() { + if (innerAudioContext) { + innerAudioContext.stop(); + innerAudioContext.destroy(); } - }, - created() { - // console.log('缁勪欢浼犲弬', this.properties); + }, /** * 缁勪欢鐨勫垵濮嬫暟鎹� @@ -52,12 +58,25 @@ type: 'fraction' }, showIndex: 0, + isPlay: false }, /** * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { + audioPlay(e) { + const src = e.currentTarget.dataset.src + innerAudioContext.src = src + if (!this.data.isPlay) { + innerAudioContext.play() + } else { + innerAudioContext.pause() + } + this.setData({ + isPlay: !this.data.isPlay + }) + }, // 鍒囨崲棰樼洰 changeSwiper(e) { this.setData({ -- Gitblit v1.9.1