0
に私は私の列で作成された取得したい私はlaravelを使用していますし、これは瞬間JS fromnow機能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;
});
}
}
});
私VUEであり、ここで私の見解は
<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>
ですmoment.jsのfromnow機能を表示して使用します。私は解決策を探すことを試みましたが、私のためには機能しません。
私はrequired('moment')
を使用しましたが、これはnpm install -g browserifyでインストールされたbrowserifyを持っていても "require not defined"と表示されるエラーです。
これを修正する方法はありますか?または、他の方法で時間を稼ぐことができますか、カーボンのdifffromhumanのようなものですか?
WebpackやBrowserifyのようなビルドシステムを使用していますか? – motanelu
この[質問](http://stackoverflow.com/questions/34308004/moment-js-with-vuejs)を見て、[vue-moment](https://github.com/brockpetrie/vue)を見てください。 - モーメント)プロジェクト。 – VincenzoC
私はまだそれを試してみるつもりはなかった – Christian