简Vue
还有一个 v-model
<table>
<tr>
<th>编号</th>
<th>姓名</th>
<th>金额</th>
</tr>
<tr v-for="account in accounts">
<td>{{account.id}}</td>
<td>{{account.name}}</td>
<td>{{account.money}}</td>
</tr>
</table>
</div>
<script>
new Vue({
el:"#app",
data:{
accounts:[],
accountMsg:{
inName:"",
outName:"",
money:""
}
},
methods:{
transfer(){
axios.post("account?operation=update","outName="+this.accountMsg.outName+"&inName="+this.accountMsg.inName+"&money="+this.accountMsg.money)
.then((resp)=>{
this.findAll();
this.accountMsg = {
inName:"",
outName:"",
money:""
}
})
},
findAll(){
axios.get("account?operation=findAll").then(resp=>{
this.accounts=resp.data;
})
}
},
created(){
this.findAll();
}
})
</script>