the data received on the server is [{"name": "TOM", "age": "16"}, {"name": "JACK", "age": "18"}, {"name": "marry", "age": "20"}]
I think there is something wrong with the loop code in html.
<ul v-for="item in items">
<li>{{ item.name }}</li>
<li>{{ item.age }}</li>
</ul>
export default {
data () {
return {
header:"",
items: [
{
name:"",
age:""
}
]
}
},
methods:{
postdata(){
var user_id = this.getcookies("user_id");
this.$http.post("http://example.com/user",{
userID:user_id
}).then(function(data){
this.items=data.body.data
}
)
}
}
}