vue-hackernews 2.0里的这段代码是什么意思?(完全蒙蔽中ing)
路径 vue-hackernews-2.0/src/views/CreateListView.js
import ItemList from '../components/ItemList.vue'
// This is a factory function for dynamically creating root-level list views,
// since they share most of the logic except for the type of items to display.
// They are essentially higher order components wrapping ItemList.vue.
export function createListView (type) {
return {
name: `${type}-stories-view`,
// this will be called during SSR to pre-fetch data into the store!
preFetch (store) {
return store.dispatch('FETCH_LIST_DATA', { type })
},
render (h) {
return h(ItemList, { props: { type }})
}
}
}
1 回复