Ich verwende Laravel und das ist mein vueMoment js fromnow Funktion vue js Laravel
Vue.http.headers.common['X-CSRF-TOKEN'] = $("#token").attr("value");
new Vue({
el: '#notificationMenu',
data: {
patients: []
},
created: function(){
this.getPatients();
this.addUsers();
},
methods: {
getPatients: function(){
$.getJSON("{{route('api_patients')}}", function(patients){
this.patients = patients;
}.bind(this));
setTimeout(this.getPatients, 1000);
},
addUsers: function(){
// var newItem = {'name':'asdfasdf','email':'sdfsdf','password':'sdfsdf'}
// var input = this.newItem;
this.$http.get('/govaccine/addUsers', '').then((response) => {
}, (response) => {
this.formErrors = response.data;
});
}
}
});
und hier ist meine Ansicht
<li class=" notif unread" v-for="patient in patients">
<a href="#">
<div class="messageblock">
<div class="message"><strong>@{{ patient.patient_lname}} @{{ patient.patient_fname}}'s</strong> next vaccination is due on 2017-03-23 for @{{patient.vaccine_name}}
</div>
<div class="messageinfo">
<i class="icon-trophy"></i>2 hours ago
</div>
</div>
</a>
</li>
Ich möchte bekommen Spalte in der erstellt schau und nutze die Funktion von moment.js und ich habe versucht, nach Lösungen zu suchen, aber sie funktionieren nicht für mich.
Ich habe required('moment')
verwendet, aber das ist immer der Fehler, den ich bekomme "require is not defined", selbst wenn das browserify über npm installiert ist -g browserify.
Haben Sie eine Möglichkeit, das zu beheben? oder irgendeine andere Methode, um die Zeit von jetzt an zu bekommen oder wie der Kohlenstoff ist diffromhuman?
Verwenden Sie ein Build-System wie Webpack oder Browserify? – motanelu
Sehen Sie diese [Frage] (http://stackoverflow.com/questions/34308004/moment-js-with-vuejs) und sehen Sie sich den [vue-moment] an (https://github.com/brockpetrie/vue -moment) Projekt. – VincenzoC
Ich habe immer noch nicht ich werde es jetzt versuchen – Christian