0
私はVueの+ Vuex + Vueのresource.Onボタンを使用してサーバからデータを取得しようとしています、私はthat.Hereは私のコードvue jsでサーバーからデータを取得する方法は?
https://plnkr.co/edit/EAaEekLtoiGPvxkmAtrt?p=preview
あるよう.Iが試したリスト形式でHTTPリクエストとショーをヒットしたいクリック// Code goes here
var store = new Vuex.Store({
state: {
Item: []
},
mutations: {
getItems: function (state) {
}
},
actions: {
fetchData:function (context) {
this.$http.get('/data.json', function(v1users)
{
// this.$set('v1_user',v1users);
});
}
}
})
var httprequest = Vue.extend({
"template": '#http_template',
data: function() {
return {
items: store.state.Item
}
},
methods: {
fetchData: function() {
store.dispatch('fetchData')
},
}
})
Vue.component('httprequest', httprequest);
var app = new Vue({
el: '#App',
data: {},
})
; udpdate?
私はそれをどうすればいいのですか?plunker – naveen
どうすればいいですか? – naveen
プランカの必要はありません。あなたのコードで 'this。$ http.get'を' Vue.http.get'に置き換えてください。それがあなたがする必要がある唯一の変更です。 – mariodev