vue-model
vue-model copied to clipboard
SSR support
Hi, very nice implementation of models in Vue! Could you provide integration with SSR or help me, how I can do it?
I did my SSR like here and I need to get model variable in asyncData hook like in this example we have store variable (also we have ability to register store module):
export default {
asyncData ({ store }) {
store.registerModule('foo', fooStoreModule)
return store.dispatch('foo/inc')
},
...
}
With models it should be like this:
import MyModel from './myModel.js'
export default {
asyncData ({ model }) {
const myModel = model('myModel', myModel)
return myModel.http. fetch()
},
...
}
It will help me load data to my model on the server side and when my page rendered, my model will be filled. Nowadays SSR very popular and a lot of people use it!
If you need some help about SSR explanation you can write me. Thank you!