File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 </view >
99 </view >
1010</template >
11- <script >
12- let music = uni .createInnerAudioContext ();
11+ <script >
1312 export default {
1413 data () {
1514 return {
1918 }
2019 },
2120 onLoad : function () {
22- music .src = ' https://img-cdn-qiniu.dcloud.net.cn/uniapp/shake/shake.wav' ;
21+ this .music = uni .createInnerAudioContext ();
22+ this .music .src = ' https://img-cdn-qiniu.dcloud.net.cn/uniapp/shake/shake.wav' ;
2323
2424 let index = 1 ,
2525 t = null ;
2626 uni .onAccelerometerChange ((res ) => {
2727 if (Math .abs (res .x ) + Math .abs (res .y ) + Math .abs (res .z ) > 20 && ! this .show && this .isOpened ) {
28- music .play ();
28+ this . music .play ();
2929 setTimeout (() => {
3030 index++ ;
3131 if (index > 4 ) {
5151 this .show = false ;
5252 this .isOpened = false ;
5353 uni .stopAccelerometer ();
54- music .destroy ();
54+ this . music .destroy ();
5555 }
5656 }
5757 </script >
You can’t perform that action at this time.
0 commit comments