Skip to content
This repository was archived by the owner on Sep 6, 2020. It is now read-only.
This repository was archived by the owner on Sep 6, 2020. It is now read-only.

SSR support #26

@dvasyliev

Description

@dvasyliev

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')
  },
  ...
}

Source of code

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions