Skip to content

Instantly share code, notes, and snippets.



Created Jun 27, 2019
What would you like to do?
const Vue = require("vue");
const createRenderer = require("vue-server-renderer").createRenderer;
const compiler = require("vue-template-compiler");
const renderToString = createRenderer().renderToString;
var App = {
template: `<div>
<div v-for="item in items">{{item}}</div>
data() {
return {
items: ["hoo", "bar"]
const res = compiler.compileToFunctions(App.template, {});
Object.assign(App, res);
var vue = new Vue(App);
renderToString(vue, (err, str) => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.