@hubcarl/egg-view-vue
v1.0.0
Published
egg view plugin for vue
Downloads
6
Maintainers
Readme
egg-view-vue
egg view plugin for [vue].
Install
$ npm i @hubcarl/egg-view-vue --save
Usage
// {app_root}/config/plugin.js
exports.vue = {
enable: true,
package: 'egg-view-vue',
};
Render in controller, support js bundle render and json bundle render (vue 2.3+)
js bundle render
// {app_root}/app/controller/test.js
exports.home = function* (ctx) {
yield ctx.render('vue-ssr-server-bundle.js', { name: 'vue js bundle render' });
};
json bundle render (vue 2.3+), need to config renderOptions
// {app_root}/config/config.default.js
exports.vue = {
renderOptions: {
template: '<!DOCTYPE html><html lang="en"><body><!--vue-ssr-outlet--></body></html>',
clientManifest: require('vue-ssr-client-manifest.json')
}
};
// {app_root}/app/controller/test.js
exports.home = function* (ctx) {
yield ctx.render('vue-ssr-server-bundle.json', { name: 'vue json render' });
};
Configuration
see config/config.default.js for more detail.
Questions & Suggestions
Please open an issue here.