Skip to content

Instantly share code, notes, and snippets.

@g-patel
Created January 18, 2017 19:02
Show Gist options
  • Save g-patel/bb604bef8d440e290d0ff9c0c0dead00 to your computer and use it in GitHub Desktop.
Save g-patel/bb604bef8d440e290d0ff9c0c0dead00 to your computer and use it in GitHub Desktop.
Vuejs Server side rendering with async data
Vue.Component({
name: 'foo',
template: `
<section v-html="markup"></section>
`,
props: [],
data() {
return {
markup: ''
};
},
created () {
this.setMarkup();
},
methods: {
setMarkup() {
//some asnc code like following which will set markup on callback
asyncFunction((err, html) => {
this.markup = html;
});
}
},
});
@g-patel
Copy link
Author

g-patel commented Jan 18, 2017

How to have markup rendered server side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment