我正在尝试制作一个静音和取消静音的功能。但是我不确定如何通过if语句显示图像路径。 目前只是一个文本按钮,点击后会在静音和取消静音之间切换。
mute() {
const video = this.refs.video;
const muteButton = this.refs.mute;
if (video.muted === false) {
video.muted = true;
muteButton.innerHTML = "Unmute"; // this should be where the image is linked
} else {
video.muted = false;
muteButton.innerHTML = "Mute"; // this should be where the image is linked
}
}
<Button ref="mute" onClick={() => this.mute()} color="danger">
Unmute
</Button>