javascript - In vue server-side rendering, after looking at several examples, why do they all use vuex to obtain and store data? Why not get it directly from the request in the component? what is the benefit?
巴扎黑
巴扎黑 2017-05-19 10:46:25
0
1
436

Official example

function fetchItem (store) {
  return store.dispatch('FETCH_ITEMS', {
    ids: [store.state.route.params.id]
  })
}

Why not just use:

function fetchItem (store) {
  //发起http请求
    axios({url:**})....
}
巴扎黑
巴扎黑

reply all(1)
小葫芦

https://github.com/vuejs/vue-...

This is the author’s answer

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template