getAccount(){
let that = this
axios({
url:'http://localhost:8080/api/GetAllUniAccounts/',
method:'post'
}).then( res => {
that.accountList=res.data // 写法错误
console.log(that.accountList)
})
}
上方是出错的地方,原因在于第7行,如果这样子写的话,该变量会失去响应式特性,正确的写法是
getAccount(){
let that = this
axios({
url:'http://localhost:8080/api/GetAllUniAccounts/',
method:'post'
}).then( res => {
that.accountList.push(...res.data)
console.log(that.accountList)
})
}