你好,我想知道为什么我不能设置我的音频在一个模式的默认值,以苗条。当我添加这一行时:audio.volume = 0.5;我的模式不再打开。以下是所有的模态组件:
<script>
export let texte;
export let clip;
let audio = document.getElementById("aled");
audio.volume = 0.5;
</script>
<style>
body
{
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.clip
{
text-align: center;
}
</style>
<body>
<div class="clip">
<audio id="aled" src={clip} controls></audio>
<div>
BLA BLA
{texte}
</div>
</div>
</body>发布于 2021-05-28 00:10:36
让我们让它更斯维特:
<script>
import { onMount } from 'svelte';
export let texte;
export let clip;
let audio;
onMount(() => {
// when the audio binding is ready set the volume
audio.volume= 0.5;
})
</script>
<style>
body
{
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.clip
{
text-align: center;
}
</style>
<body>
<div class="clip">
<audio bind:this={audio} src={clip} controls></audio>
<div>
BLA BLA
{texte}
</div>
</div>
</body>https://stackoverflow.com/questions/67729742
复制相似问题