补了个...键盘切歌的..没用玩意(

This commit is contained in:
NanoRocky 2024-12-14 23:20:37 +08:00
parent f18146c54d
commit be7c75c694
2 changed files with 26 additions and 6 deletions

View File

@ -119,17 +119,37 @@ const changeMusicIndex = (type) => {
};
onMounted(() => {
//
window.addEventListener("keydown", (e) => {
//
const handleKeydown = (e) => {
if (!store.musicIsOk) {
return;
}
if (e.code == "Space") {
changePlayState();
switch (e.code) {
case "Space": // /
e.preventDefault(); //
changePlayState();
break;
case "PageUp": //
e.preventDefault();
changeMusicIndex(0);
break;
case "PageDown": //
e.preventDefault();
changeMusicIndex(1);
break;
}
});
};
//
window.addEventListener("keydown", handleKeydown);
// window
window.$openList = openMusicList;
//
onUnmounted(() => {
window.removeEventListener("keydown", handleKeydown);
});
});
//

View File

@ -8,7 +8,7 @@ let timeoutId = null;
* Speech
* Made by NanoRocky
* 使用指定参数生成语音并播放音频
* 该功能原为 Azure 设计理应兼容大部分使用 post 传参的 api 请自行根据要求修改
* 该功能原为 Azure 设计理应兼容大部分使用 post 传参的 api 请自行根据要求修改如果也使用 Azure 您可直接使用 https://github.com/NanoRocky/AzureSpeechAPI-by-PHP 完成 API 部署
* https://learn.microsoft.com/zh-cn/azure/ai-services/speech-service/speech-synthesis-markup-voice
*
* @param {string} text - 朗读的文本