var vm = new Vue({
el:"#content",
data: {
goodsname:"",
goodscategory:[]
},
methods: {
submit: function () {
}
},
ready: function() {
var self = this;
this.$http.jsonp({url: 'http://localhost/wang/index.php/Home/Vue/goodscategory', method: 'POST'}).then(function (response) {
// set data on vm
self.$set('goodscategory', response.data)
}, function (response) {
// error callback
});
}
})
这个不是vue-resource的问题。你的goodscategory这个数组应该有v-for的遍历操作吧,当数组中有重复的值(Duplicate value)的时候,建议指定track-by="$index"来提供一个类似于键值的唯一值供追踪。