work.suroh.tk/node_modules/@11ty/eleventy/test/stubs/vue-layout.11ty.js

21 lines
488 B
JavaScript
Raw Normal View History

2019-12-02 12:22:45 +00:00
const Vue = require("vue");
const renderer = require("vue-server-renderer").createRenderer({
template: `<!doctype html>
<title>{{ title }}</title>
<!--vue-ssr-outlet-->`
});
module.exports = async function(data) {
var app = new Vue({
template: "<p>Hello {{ data.name }}, this is a Vue template.</p>",
data: function() {
return { data };
}
// components: {
// 'test': ComponentA
// }
});
return renderer.renderToString(app, { title: "Test" });
};