We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nuxt.config.js
... modules: [ '@nuxtjs/axios', ['@nuxtjs/moment', ['ja']] ], plugins: [ ... '~/plugins/formatter.js', ... ], ...
~/plugins/formatter.js
export default ({ app }, inject) => { inject('versionFormat', (date) => app.$moment(date).format('YYYY/MM/DD HH:mm:ss.SSS')) }
The above code doesn't work because app.$moment is undefined. Maybe same as #3.
app.$moment
I want you to change it like @nuxtjs/axios module.
@nuxtjs/axios
https://github.com/nuxt-community/moment-module/blob/master/lib/moment.plugin.js
-import Vue from 'vue' import moment from 'moment' <%= options.locales.map(l => `import 'moment/locale/${l}'`).join('\n') %> -if (!Vue.prototype.hasOwnProperty('$moment')) { - Object.defineProperty(Vue.prototype, '$moment', { - get() { - return moment - } - }) -} +export default (ctx, inject) => { + ctx.$moment = moment + inject('moment', moment) +}
*** Sorry, not tested.**
The text was updated successfully, but these errors were encountered:
feat: improvements (#8)
98c790d
- Use inject - Update deps - Add defaultLocale option Resolves #6 Resolves #5 Resolves #4 Resolves #3
Successfully merging a pull request may close this issue.
nuxt.config.js
~/plugins/formatter.js
The above code doesn't work because
app.$moment
is undefined.Maybe same as #3.
I want you to change it like
@nuxtjs/axios
module.https://github.com/nuxt-community/moment-module/blob/master/lib/moment.plugin.js
*** Sorry, not tested.**
The text was updated successfully, but these errors were encountered: