vue 文字转声音

const synth = window.speechSynthesis;
const msg = new SpeechSynthesisUtterance();

export function voiceSpeak(e) {
  msg.text = e;
  msg.lang = 'zh-CN';
  msg.volume = '1';
  msg.rate = 1;
  msg.pitch = 1;
  // synth.cancel();
  synth.speak(msg);
}

记录下,

原文地址:https://www.cnblogs.com/huanyun/p/15243881.html