Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
610
Widok
0
02/01/2022 4:04 pm
Topic starter
how to write simple plugin
1 Answer
0
02/01/2022 4:06 pm
Topic starter
app.js
import DateHelpers from './helpers/DateHelpers' ... app.use(DateHelpers);
inside DateHelpers.js
import moment from 'moment';
import 'moment/min/locales';
export default {
install: (app, options) => {
app.mixin({
methods: {
ago: function (date) {
return moment(date).fromNow();
},
},
})
},
};
now we can use ago() function inside our components