[Vuejs]-Cannot read property '$moment' of undefined

0👍

just install moment by using below command

npm install moment

0👍

My configuration in nuxt.config.js:

...

modules: [
    '@nuxtjs/moment',
    ['@nuxtjs/moment', { tdefaultLocale: 'en',
    locales: ['en'] }]
]

...

Then use it like this on any page:

<span> {{$moment(timestamp_var).format('ddd DD MMM') }} </span>

Leave a comment