xiongzhu 2 yıl önce
ebeveyn
işleme
0942775a9a
1 değiştirilmiş dosya ile 12 ekleme ve 0 silme
  1. 12 0
      src/views/PlayView.vue

+ 12 - 0
src/views/PlayView.vue

@@ -221,6 +221,18 @@ onMounted(() => {
                     ...history.value[history.value.length - 1],
                     plot: data.data
                 }
+                // 创建一个新的SpeechSynthesisUtterance对象
+                var utterance = new SpeechSynthesisUtterance()
+                // 语速
+                utterance.rate = 1.5;
+                // 设置要合成的文本
+                utterance.text = data.data
+
+                // 获取语音合成对象
+                var synth = window.speechSynthesis
+
+                // 添加要合成的文本到队列中
+                synth.speak(utterance)
                 break
             case 'options':
                 if (history.value[history.value.length - 1].id !== -1) {