|
|
@@ -113,17 +113,16 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { backgroundMusicPlayer } from "../../../utils/sounds";
|
|
|
|
|
|
export default {
|
|
|
- props: [ "description", "params", "bgmUrl"],
|
|
|
+ props: [ "description", "params", "bgmUrl","bgmstatus"],
|
|
|
data() {
|
|
|
return {
|
|
|
showDescription: false,
|
|
|
showMore: false,
|
|
|
shareURL: "",
|
|
|
isVR: false,
|
|
|
- isMusicPlaying: false,
|
|
|
+ isMusicPlaying: this.bgmstatus,
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -131,11 +130,7 @@ export default {
|
|
|
onMenuClick(name) {
|
|
|
this.$nextTick(() => {
|
|
|
if (name == "music") {
|
|
|
- if (this.isMusicPlaying) {
|
|
|
- backgroundMusicPlayer.pause();
|
|
|
- } else {
|
|
|
- backgroundMusicPlayer.play();
|
|
|
- }
|
|
|
+ this.isMusicPlaying = !this.isMusicPlaying
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -172,21 +167,19 @@ export default {
|
|
|
watch: {
|
|
|
bgmUrl(newVal) {
|
|
|
if (newVal) {
|
|
|
- console.log(newVal,'newVal');
|
|
|
- backgroundMusicPlayer.setSRC(newVal);
|
|
|
- backgroundMusicPlayer.play();
|
|
|
+ this.isMusicPlaying = true
|
|
|
}
|
|
|
},
|
|
|
+ isMusicPlaying(newVal){
|
|
|
+ this.$emit('toggleBGM',newVal)
|
|
|
+ },
|
|
|
+ bgmstatus(newVal){
|
|
|
+ this.isMusicPlaying = newVal
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
- backgroundMusicPlayer.on("play", () => {
|
|
|
- this.isMusicPlaying = true;
|
|
|
- });
|
|
|
-
|
|
|
- backgroundMusicPlayer.on("off", () => {
|
|
|
- this.isMusicPlaying = false;
|
|
|
- });
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|