egg-view-vue

vue view plugin for egg

Showing:

Popularity

Downloads/wk

40

GitHub Stars

138

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

3

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

egg-view-vue

NPM version build status Test coverage David deps Known Vulnerabilities npm download

egg view plugin for [vue].

Install

$ npm i 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) {
  // {app_root}/app/view/vue-ssr-server-bundle.js
  yield ctx.render('vue-ssr-server-bundle.js', { name: 'vue js bundle render' });
};

json bundle render (vue 2.3+), need to config renderOptions createBundleRenderer

// {app_root}/config/config.default.js
exports.vue = {
   // renderOptions config, please @see https://ssr.vuejs.org/en/api.html#renderer-options
   renderOptions: {
     // template: '<!DOCTYPE html><html lang="en"><body><!--vue-ssr-outlet--></body></html>',

     // webpack vue ssr plugin build manifest file
     // clientManifest: require(path.join(app.baseDir,'public/vue-ssr-client-manifest.json')),
   }
};
// {app_root}/app/controller/test.js
exports.home = function* (ctx) {
  // {app_root}/app/view/vue-ssr-server-bundle.json
  yield ctx.render('vue-ssr-server-bundle.json', { name: 'vue json render' });
};

vue server side render example, please see egg-vue-webpack-boilerplate

Configuration

see config/config.default.js for more detail.

Questions & Suggestions

Please open an issue here.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100