mojo-plugin-vue
v0.4.1
Published
A mojo.js plugin that adds support for [vue](https://vuejs.org/) templates.
Readme
A mojo.js plugin that adds support for vue templates.
import mojo from '@mojojs/core';
import vuePlugin from 'mojo-plugin-vue';
const app = mojo();
app.plugin(vuePlugin);
// Render template "views/index.html.vue"
app.get('/template', async ctx => {
await ctx.render({view: 'index'});
});
// Render a template with content inside brackets (vue-style), Example: <div>Hello {{ greeting }}</div>
app.get('/template-with-data', async ctx => {
await ctx.render({view: 'index'}, {greeting: 'World'});
});
app.start();To change the default engine for inline templates you can also set app.renderer.defaultEngine to vue. Or you can
register the template engine with a completely different name.
app.plugin(vuePlugin, {name: 'foo'});
app.renderer.defaultEngine = 'foo';