|
@@ -1,12 +1,5 @@
|
|
|
<template>
|
|
|
<div class="smenu">
|
|
|
- <audio
|
|
|
- ref="vbgm"
|
|
|
- class="noshow"
|
|
|
- loop
|
|
|
- :src="require(`@/assets/audio/bgm.mp3`)"
|
|
|
- ></audio>
|
|
|
-
|
|
|
<template v-if="!tourStatus">
|
|
|
<div class="sdaolan brightness">
|
|
|
<div @click="toggle" class="daolan ">
|
|
@@ -101,12 +94,21 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- isBgm(newVal) {
|
|
|
- !newVal ? this.$refs.vbgm.pause() : this.$refs.vbgm.play();
|
|
|
+ isBgm:{
|
|
|
+ immediate:true,
|
|
|
+ handler:function(newVal){
|
|
|
+ this.$bus.$emit('toggleHomeBgm',newVal)
|
|
|
+ // !newVal ? this.$refs.vbgm.pause() : this.$refs.vbgm.play();
|
|
|
+ }
|
|
|
},
|
|
|
tourStatus(newVal){
|
|
|
if (newVal) {
|
|
|
- this.isBgm = false
|
|
|
+ this.isBgm = false;
|
|
|
+ } else{
|
|
|
+ let status = localStorage.getItem('g_bgmstatus')
|
|
|
+ if (status==='open') {
|
|
|
+ this.isBgm = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -143,12 +145,7 @@ export default {
|
|
|
this.isBgm = true;
|
|
|
localStorage.setItem('g_bgmstatus',this.isBgm?'open':'close')
|
|
|
this.$nextTick(()=>{
|
|
|
- setTimeout(() => {
|
|
|
- if (this.$refs.vbgm.paused) {
|
|
|
- this.isBgm = false
|
|
|
- localStorage.setItem('g_bgmstatus',this.isBgm?'open':'close')
|
|
|
- }
|
|
|
- this.$bus.$on("toggleBGM", (data) => {
|
|
|
+ this.$bus.$on("toggleBGM", (data) => {
|
|
|
if (!data) {
|
|
|
this.isBgm = data;
|
|
|
} else{
|
|
@@ -157,8 +154,7 @@ export default {
|
|
|
this.isBgm = data;
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
- });
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
};
|