Skip to content

Instantly share code, notes, and snippets.

@saboyutaka
Created June 29, 2020 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saboyutaka/a2a26afca4aac3c4d03c7e0d64b07805 to your computer and use it in GitHub Desktop.
Save saboyutaka/a2a26afca4aac3c4d03c7e0d64b07805 to your computer and use it in GitHub Desktop.
Nuxt helper
# lib/helpers.js
module.exports = {
appName: () => {
return process.env.APP_NAME;
},
};
# plugins/helpers.js
import Vue from 'vue';
import helpers from '~/lib/helpers';
const plugin = {
install() {
Vue.helpers = helpers;
Vue.prototype.$helpers = helpers;
},
};
Vue.use(plugin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment