add audio
Showing
2 changed files
with
14 additions
and
4 deletions
| ... | @@ -39,6 +39,7 @@ | ... | @@ -39,6 +39,7 @@ | 
| 39 | - 本抽奖程序无暗箱操作,无后台,无后门。 | 39 | - 本抽奖程序无暗箱操作,无后台,无后门。 | 
| 40 | - 名单和照片显示只需导入一种即可,无导入数据则使用抽奖号码。 | 40 | - 名单和照片显示只需导入一种即可,无导入数据则使用抽奖号码。 | 
| 41 | - 建议使用最新的 Chrome 浏览器打开体验最佳。 | 41 | - 建议使用最新的 Chrome 浏览器打开体验最佳。 | 
| 42 | - 由于背景游戏音乐加载较慢,可以在抽奖前提前打开缓存好。 | ||
| 42 | 43 | ||
| 43 | ## License | 44 | ## License | 
| 44 | 45 | ... | ... | 
| ... | @@ -68,7 +68,15 @@ | ... | @@ -68,7 +68,15 @@ | 
| 68 | </div> | 68 | </div> | 
| 69 | </transition> | 69 | </transition> | 
| 70 | 70 | ||
| 71 | <el-button class="audio" type="text" @click="audioPlaying = !audioPlaying"> | 71 | <el-button | 
| 72 | class="audio" | ||
| 73 | type="text" | ||
| 74 | @click=" | ||
| 75 | () => { | ||
| 76 | playAudio(!audioPlaying); | ||
| 77 | } | ||
| 78 | " | ||
| 79 | > | ||
| 72 | <i | 80 | <i | 
| 73 | class="iconfont" | 81 | class="iconfont" | 
| 74 | :class="[audioPlaying ? 'iconstop' : 'iconplay1']" | 82 | :class="[audioPlaying ? 'iconstop' : 'iconplay1']" | 
| ... | @@ -96,6 +104,7 @@ | ... | @@ -96,6 +104,7 @@ | 
| 96 | autoplay | 104 | autoplay | 
| 97 | loop | 105 | loop | 
| 98 | @play="playHandler" | 106 | @play="playHandler" | 
| 107 | @pause="pauseHandler" | ||
| 99 | > | 108 | > | 
| 100 | <source :src="audioSrc" /> | 109 | <source :src="audioSrc" /> | 
| 101 | 你的浏览器不支持audio标签 | 110 | 你的浏览器不支持audio标签 | 
| ... | @@ -231,9 +240,6 @@ export default { | ... | @@ -231,9 +240,6 @@ export default { | 
| 231 | this.reloadTagCanvas(); | 240 | this.reloadTagCanvas(); | 
| 232 | }); | 241 | }); | 
| 233 | } | 242 | } | 
| 234 | }, | ||
| 235 | audioPlaying(v) { | ||
| 236 | this.playAudio(v); | ||
| 237 | } | 243 | } | 
| 238 | }, | 244 | }, | 
| 239 | mounted() { | 245 | mounted() { | 
| ... | @@ -246,6 +252,9 @@ export default { | ... | @@ -246,6 +252,9 @@ export default { | 
| 246 | playHandler() { | 252 | playHandler() { | 
| 247 | this.audioPlaying = true; | 253 | this.audioPlaying = true; | 
| 248 | }, | 254 | }, | 
| 255 | pauseHandler() { | ||
| 256 | this.audioPlaying = false; | ||
| 257 | }, | ||
| 249 | playAudio(type) { | 258 | playAudio(type) { | 
| 250 | if (type) { | 259 | if (type) { | 
| 251 | this.$el.querySelector('#audiobg').play(); | 260 | this.$el.querySelector('#audiobg').play(); | ... | ... | 
- 
Please register or sign in to post a comment