Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eslotsys-game-nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
毛线
eslotsys-game-nuxt
Commits
31e30662
Commit
31e30662
authored
Jul 31, 2023
by
毛线
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
声音设置
parent
6665bceb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
index.vue
components/common/audio/index.vue
+15
-1
No files found.
components/common/audio/index.vue
View file @
31e30662
...
...
@@ -6,7 +6,7 @@
<
script
>
import
{
mapState
,
}
from
'vuex'
import
{
mapState
,
mapMutations
,
}
from
'vuex'
export
default
{
data
()
{
const
bgAudio
=
new
Audio
()
...
...
@@ -54,6 +54,11 @@ export default {
volumeMachine
()
{},
volumeBg
(
value
)
{
this
.
bgAudio
.
volume
=
value
/
100
if
(
value
===
0
)
{
this
.
SetMute
(
true
)
}
else
{
this
.
SetMute
(
false
)
}
},
volumeButton
(
value
)
{
this
.
uiClickAudio
.
volume
=
value
/
100
...
...
@@ -63,6 +68,9 @@ export default {
this
.
init
()
},
methods
:
{
...
mapMutations
(
'audio'
,
[
'SetMute'
,
// 设置静音状态
]),
init
()
{
console
.
log
(
'初始化音频'
)
this
.
bgAudio
.
src
=
'https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/sound/Innovation.mp3'
// 背景音乐
...
...
@@ -76,10 +84,16 @@ export default {
if
(
mute
)
{
// 如果静音
return
}
if
(
this
.
volumeBg
===
0
)
{
return
}
this
.
bgAudio
.
play
()
},
// ui点击音效
playClickAudio
()
{
if
(
this
.
volumeButton
===
0
)
{
return
}
this
.
uiClickAudio
.
currentTime
=
0
this
.
uiClickAudio
.
play
()
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment