新增上一页功能,BGM自动引入

This commit is contained in:
Andy Leong
2024-01-11 16:10:51 +08:00
parent bbef428f80
commit de023d9c2e
4 changed files with 46 additions and 11 deletions

View File

@@ -2,6 +2,8 @@
import gsap from 'gsap'
import { Howl, Howler } from 'howler';
// 初始化
const btnEnable = ref(true) //按钮可点击状态
@@ -10,6 +12,23 @@ const sound = new Howl({
src: [new URL(`@/assets/media/click.mp3`, import.meta.url).href]
});
// 背景音乐
export function bgm(autoPlay) {
let div = document.createElement('div')
let audio = document.createElement('audio')
div.append(audio)
document.body.append(div)
// const bgm = new Howl({ src: [new URL(`@/assets/media/bgm.mp3`, import.meta.url).href] });
// bgm.play()
}
//是否在微信环境
export function isWX() {
var ua = window.navigator.userAgent.toLowerCase();