nuxt-global-var

1.0.2 • Public • Published

nuxt-global-var

A module for nuxtjs that make defining and using variables in component easier by using js object or json file.

How to use

Install

npm install nuxt-global-var

Basic usage

Firstly, you need to add nuxt-global-var to your Nuxt config.

// nuxt.config.js
 
{
  modules: [
    [
      'nuxt-global-var',
      {
        data: {HOST: 'shinryak.site'}
      }
    ]
  ]
}

Now, you can use nuxt-global-var in your component

<templete>
    <h1>
        Test nuxt-global-var in component
    </h1>
    <p>
        {{ $get('HOST') }}
    </p>
</templete>

Licence

MIT License

Package Sidebar

Install

npm i nuxt-global-var

Weekly Downloads

7

Version

1.0.2

License

MIT

Unpacked Size

3.47 kB

Total Files

5

Last publish

Collaborators

  • minhchi3103