vue 怎么向后台传输 从麦克风获取的wav文件

        var pcm = this.rc.getRecord();
        const blob = encodeWAV(pcm,16,44100);
        let formData = new FormData();
        formData.append('file',blob);
         this.$http.post(jieapi.speechRecogn,formData).then((res)=>{
             if(res.file && res.file != ''){
              
                }else{
              
             }
           
         })
         
        
阅读 3.5k
1 个回答

问题有点奇怪

this.$http.post(jieapi.speechRecogn,formData)//这个已经提交请求了嘛,这里请求返回一个 Promise

.then((res)=>{ //提交成功的回调函数
    //res后台返回的数据
})

关于Promise https://juejin.im/post/5c2dd2...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题