js return new Promise resoluve
searchFun: function(codes) { return new Promise(resolve = >{ axios.post(url, {}).then(res = >{ if (res.data.success === true) { console.log('res.data:', res.data); if (res.data.data.list.length > 0) { resolve(res.data.data.list); } } else { this.$Modal.error({ title: '提示', content: '提示内容' }); } }). catch(() = >{ this.$Modal.error({ title: '提示', content: '提示内容' }); }); } } this.searchFun(codeNumber).then(rep = >{ this.print(rep); });