我在发出axios获取请求后,在Vue中设置对象containerInfo
的res.data,如下所示:
methods: {
searchcontainers(containerSearch) {
this.containerQuery = JSON.parse(containerSearch.container_query)[0];
this.imageBranch = JSON.parse(containerSearch.container_query)[1];
this.containerInfo["image_branch"] = this.imageBranch
this.url = this.containerQuery.split('/');
axios.get(`http://localhost:8000/get?name=${this.url[0]}/${this.url[1]}/${this.url[2]}&ver=${this.url[3]}`)
.then(res => this.containerInfo = res.data)
.then(this.containerInfo = [...this.containerInfo,this.imageBranch]);
}
我想在vue中接收/设置数据对象后,将this.imageBranch
添加到containerInfo
对象中。
问题在于axios res一旦收到(花费几秒钟),就会删除添加的this.imageBranch
键/值。我知道在诺言解决后我应该添加它,但我不知道如何做。
有人可以帮忙吗!