| 1 |
import Vue from 'vue' |
| 2 |
import Vuex from 'vuex' |
| 3 |
import Axios from 'axios' |
| 4 |
import VueAxios from 'vue-axios' |
| 5 |
import Toasted from 'vue-toasted' |
| 6 |
import mixin from '@mixins/index' |
| 7 |
import moment from 'moment-timezone' |
| 8 |
import Bookit from '@views/bookit' |
| 9 |
import store from '@store/index' |
| 10 |
const _ = require('lodash') |
| 11 |
const $ = require('jquery') |
| 12 |
|
| 13 |
/** |
| 14 |
* Init Moment |
| 15 |
*/ |
| 16 |
moment.tz.setDefault('GMT'); |
| 17 |
Vue.prototype.moment = moment; |
| 18 |
Vue.filter('moment', function (date, format) { |
| 19 |
return moment(date).format(format); |
| 20 |
}); |
| 21 |
Vue.use(Vuex) |
| 22 |
|
| 23 |
|
| 24 |
$( document ).ready(() => { |
| 25 |
Vue.use( VueAxios, Axios ); |
| 26 |
Vue.mixin( mixin ); |
| 27 |
Vue.use( Toasted); |
| 28 |
|
| 29 |
$('.bookit-app').each(function () { |
| 30 |
new Vue({ |
| 31 |
el: $(this)[0],// selector |
| 32 |
beforeCreate() { |
| 33 |
this.$store = createStore(_.cloneDeep(store)); |
| 34 |
}, |
| 35 |
components: { |
| 36 |
'bookit': Bookit, // Frontend main component |
| 37 |
}, |
| 38 |
}); |
| 39 |
}); |
| 40 |
|
| 41 |
}); |
| 42 |
|
| 43 |
function createStore (store) { |
| 44 |
return new Vuex.Store(store); |
| 45 |
} |
| 46 |
|
| 47 |
|