Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Latest commit

 

History

History
33 lines (22 loc) · 997 Bytes

README.md

File metadata and controls

33 lines (22 loc) · 997 Bytes

vue-const

Adds a constants section in Vue components.

npm npm bundle size (minified + gzip) npm NpmLicense

Install:

npm install vue-const

or

yarn add vue-const

Enable it in your project:

import VueConst from 'vue-const';
Vue.use(VueConst);

You can now declare your constants (must use all upper case identifiers):

export default {
  const: {
    NAME_OF_CONSTANT: value1, 
    OTHER: value2, 
    ...
  }
}

Constants defined this way are used like any data property (for example by this.NAME in code or simply NAME in templates). Obviously, they are not reactive.