<el-table border :data="filelist">
<el-table-column label="ID" width="90px" prop="fid"></el-table-column>
<el-table-column label="" prop="project"></el-table-column>
</el-table>
loadFilelsit() {
this.$request.get("/resource/myfilelist", {
params: {
"_catalog": "relatednop", "_direction": "DESC", "_num": this.numperpage, "_page":1
}
}).then((m) => {
this.filelist = JSON.parse(JSON.stringify(m.data.items))
this.totalnum = m.data.total
let filenum = this.filelist.length
for(var idx = 0; idx < filenum; idxPP) {
this.filelist[idx].project = ""
this.updateSingleFileinfo(idx)
}
}).catch((err) => {
})
},
updateSingleFileinfo(idx) {
this.$request.get("/resource/file/"+this.filelist[idx].fid, {
params: {
"_expand": 1
}
}).then((m) => {
//
if(m.data.project_info) {
this.filelist[idx].project = m.data.project_info.name
}
else {
this.filelist[idx].project = ""
}
//
// this.filelist[idx]["filename"] = m.data["filename"]
this.filelist[idx]["filename"] = m.data.filename
}).catch((err) =>{
})
filelist is an array defined in data, and the contents of the array are complete after two http requests. The first time the http request gets the ID, of each member of the file list in the filelist, the second time it gets the details of each item in the filelist and updates it to the member of the filelist array.
but after the array information is updated after the second Http request, the "ownership project" displayed on the table can never be updated, and it is true that the contents of the filelist array have changed under debugging.
this two-way data binding is fake.