Skip to content

Commit fac1d3b

Browse files
committed
refactor: 修改摇一摇
1 parent 3224293 commit fac1d3b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

platforms/app-plus/shake/shake.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
</view>
99
</view>
1010
</template>
11-
<script>
11+
<script>
12+
let music = uni.createInnerAudioContext();
1213
export default {
1314
data() {
1415
return {
@@ -18,7 +19,6 @@
1819
}
1920
},
2021
onLoad: function () {
21-
let music = uni.createInnerAudioContext();
2222
music.src = 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/shake/shake.wav';
2323
2424
let index = 1,
@@ -50,7 +50,8 @@
5050
onUnload() {
5151
this.show = false;
5252
this.isOpened = false;
53-
uni.stopAccelerometer();
53+
uni.stopAccelerometer();
54+
music.destroy();
5455
}
5556
}
5657
</script>

0 commit comments

Comments
 (0)