Using enums anywhere which is more advanced than typescript enum
$ npm install nuxt-router-enum- module configuration
// nuxt.config.js
export default {
modules: [
[
'nuxt-router-enum',
{
/* module options */
},
],
],
// or
enum: {
/* module options */
path: '~/enums',
fileName: 'index.js',
},
};- enums configuration
// ~/enums/index.js
export default {
FOO: [
{
key: 'FOO_KEY_1',
text: 'foo text 1',
value: 1,
},
{
key: 'FOO_KEY_2',
text: 'foo text 2',
value: 2,
},
],
};-
pathLocation of your route file
- Type:
string - Default:
~
- Type:
-
fileNameFile name of your routes configuration in
pathMust export valid Vue routes- Type:
string - Default:
index.js
- Type:
-
routerOptionsSame as
vue-routerrouter options