showBp(bp) {
this.getBpJson(bp);
console.log(this.bpJson);
// this.bp2tree(this.bpJson);
},
getBpJson(bp) {
var that = this;
this.$post('/flow/bp/bpJson',bp).then((resp) => {
that.bpJson = resp.data;
});
},
打印为null,但是过会打印就有结果了
异步请求肯定没同步快啊,axios异步的。你应该把打印或者需要用到bpJson的代码写到then()里边
showBp(bp) {
this.getBpJson(bp);
},
getBpJson(bp) {
var that = this;
this.$post('/flow/bp/bpJson',bp).then((resp) => {
that.bpJson = resp.data;
console.log(that.bpJson);
// that.bp2tree(that.bpJson);
});
},
getBpJson要用回调函数接收后台返回的数据。
axios是异步的他又then方法和catch方法