2019-06-03 03:31:38 +00:00
|
|
|
import Vue from 'vue';
|
2019-11-13 02:14:24 +00:00
|
|
|
import VTooltip from 'v-tooltip';
|
2020-04-08 12:50:43 +00:00
|
|
|
import VueLazyLoad from 'vue-lazyload';
|
|
|
|
import dayjs from 'dayjs';
|
2019-06-03 03:31:38 +00:00
|
|
|
|
|
|
|
import router from './router';
|
|
|
|
import initStore from './store';
|
|
|
|
|
2020-03-28 03:37:04 +00:00
|
|
|
import initUiObservers from './ui/observers';
|
|
|
|
|
2019-06-03 03:31:38 +00:00
|
|
|
import '../css/style.scss';
|
|
|
|
|
|
|
|
import Container from '../components/container/container.vue';
|
2019-10-28 01:54:37 +00:00
|
|
|
import Icon from '../components/icon/icon.vue';
|
2019-06-03 03:31:38 +00:00
|
|
|
|
2020-07-03 02:12:56 +00:00
|
|
|
function formatDate(date, format = 'MMMM D, YYYY', precision = 'day') {
|
|
|
|
if (precision === 'year') {
|
|
|
|
const newFormat = format.match(/Y+/);
|
|
|
|
return dayjs(date).format(newFormat ? newFormat[0] : 'YYYY');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (precision === 'month') {
|
|
|
|
const newFormat = format.match(/(M{1,4})|(Y{2,4})/g);
|
|
|
|
return dayjs(date).format(newFormat ? newFormat.join(' ') : 'MMMM YYYY');
|
|
|
|
}
|
|
|
|
|
|
|
|
return dayjs(date).format(format);
|
|
|
|
}
|
|
|
|
|
2019-06-03 03:31:38 +00:00
|
|
|
function init() {
|
2020-05-14 02:26:05 +00:00
|
|
|
const store = initStore(router);
|
|
|
|
|
|
|
|
initUiObservers(store, router);
|
|
|
|
|
|
|
|
if (window.env.sfw) {
|
|
|
|
store.dispatch('setSfw', true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.mixin({
|
|
|
|
components: {
|
|
|
|
Icon,
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
pageTitle(title) {
|
|
|
|
if (title) {
|
|
|
|
document.title = `traxxx - ${title}`;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.title = 'traxxx';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2020-07-03 02:12:56 +00:00
|
|
|
formatDate,
|
2020-05-14 02:26:05 +00:00
|
|
|
isAfter: (dateA, dateB) => dayjs(dateA).isAfter(dateB),
|
|
|
|
isBefore: (dateA, dateB) => dayjs(dateA).isBefore(dateB),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-07-19 01:52:36 +00:00
|
|
|
Vue.use(VTooltip, {
|
|
|
|
popover: {
|
|
|
|
defaultContainer: '.container',
|
|
|
|
},
|
|
|
|
});
|
2020-05-14 02:26:05 +00:00
|
|
|
Vue.use(VueLazyLoad, {
|
|
|
|
throttleWait: 0,
|
|
|
|
});
|
|
|
|
|
|
|
|
new Vue({ // eslint-disable-line no-new
|
|
|
|
el: '#container',
|
|
|
|
store,
|
|
|
|
router,
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(Container);
|
|
|
|
},
|
|
|
|
});
|
2019-06-03 03:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
init();
|