I'm loading the daterangepicker and moment globally but its not working, everything is installed. Have a looks at my code:
window._ = require('lodash');
window.$ = window.jQuery = require('jquery');
window.moment = require('moment');
require('daterangepicker');
require('bootstrap-sass');
import Vue from 'vue';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
import axios from 'axios';
import noty from 'noty';
import sweetalert from 'sweetalert';
window.Vue = Vue;
Vue.use(VueRouter);
window.axios = axios;
window.axios.defaults.headers.common = {
'X-Requested-With': 'XMLHttpRequest'
};
Table
import {ServerTable, Event} from 'vue-tables-2';
Vue.use(ServerTable, {
filterByColumn: true,
compileTemplates: true,
responseAdapter: function (resp) {
return {
data: resp.data,
count: resp.total
}
},
templates: {
open: 'open-vuetable-resource'
},
sortIcon: {
base:'fa',
up:'fa-sort-amount-asc',
down:'fa-sort-amount-desc'
},
rowClassCallback: function(row) {return `row-${row.id}`},
datepickerOptions: {
showDropdowns: true
}
});
Vue.component('open-vuetable-resource', {
props: ['data'],
template: `<a :href="data.ShowAdmin" class='btn btn-primary'><i class="fa fa-eye"></i></a>`
});
Create table
$(document).ready(function() {
new Vue({
el: "#people",
data: {
columns: ['id', 'username', 'email', 'created_at', 'open'],
options: {
filterable: ['id', 'username', 'created_at', 'email'],
sortable: ['id', 'username', 'created_at', 'email'],
dateColumns: ['created_at']
}
}
});
});
I have tried with moment(created_at), but still nothing. Any tips on why the datepicker is not working for me?
I'm running out of ideas :D
Thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire