vue实现百度语音播报API调用 //百度语音播报 Vue.prototype.$speckText = function(str) { var url = "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=6&text=" + encodeURI(str); new Audio(url).play(); }, 组件中使用 this.$speckText("hello world!")