2020-12-27 21:45:38 +00:00
|
|
|
import { createApp } from 'vue';
|
2020-04-08 12:50:43 +00:00
|
|
|
import dayjs from 'dayjs';
|
2020-12-27 03:21:10 +00:00
|
|
|
import mitt from 'mitt';
|
|
|
|
|
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';
|
|
|
|
|
2020-08-20 18:48:52 +00:00
|
|
|
import { formatDate, formatDuration } from './format';
|
|
|
|
|
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';
|
2020-08-15 17:04:33 +00:00
|
|
|
import Footer from '../components/footer/footer.vue';
|
2020-12-26 22:51:27 +00:00
|
|
|
import Tooltip from '../components/tooltip/tooltip.vue';
|
2021-01-03 21:53:51 +00:00
|
|
|
import Dialog from '../components/dialog/dialog.vue';
|
2019-06-03 03:31:38 +00:00
|
|
|
|
2020-12-26 22:51:27 +00:00
|
|
|
async function init() {
|
2021-01-03 21:53:51 +00:00
|
|
|
let uid = 0;
|
|
|
|
|
2020-12-27 21:45:38 +00:00
|
|
|
const store = initStore(router);
|
2020-12-26 22:51:27 +00:00
|
|
|
const app = createApp(Container);
|
2020-12-27 03:21:10 +00:00
|
|
|
const events = mitt();
|
2020-05-14 02:26:05 +00:00
|
|
|
|
|
|
|
initUiObservers(store, router);
|
|
|
|
|
|
|
|
if (window.env.sfw) {
|
|
|
|
store.dispatch('setSfw', true);
|
|
|
|
}
|
|
|
|
|
2020-12-26 22:51:27 +00:00
|
|
|
app.use(store);
|
|
|
|
app.use(router);
|
|
|
|
|
|
|
|
await router.isReady();
|
|
|
|
|
|
|
|
app.mixin({
|
2020-05-14 02:26:05 +00:00
|
|
|
components: {
|
|
|
|
Icon,
|
2020-08-15 17:04:33 +00:00
|
|
|
Footer,
|
2020-12-26 22:51:27 +00:00
|
|
|
Tooltip,
|
|
|
|
'v-popover': Tooltip,
|
2021-01-03 21:53:51 +00:00
|
|
|
Dialog,
|
2020-05-14 02:26:05 +00:00
|
|
|
},
|
2020-12-27 03:21:10 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
events,
|
|
|
|
};
|
|
|
|
},
|
2020-05-14 02:26:05 +00:00
|
|
|
watch: {
|
|
|
|
pageTitle(title) {
|
|
|
|
if (title) {
|
|
|
|
document.title = `traxxx - ${title}`;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.title = 'traxxx';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2020-07-03 02:12:56 +00:00
|
|
|
formatDate,
|
2020-08-20 17:52:02 +00:00
|
|
|
formatDuration,
|
2020-05-14 02:26:05 +00:00
|
|
|
isAfter: (dateA, dateB) => dayjs(dateA).isAfter(dateB),
|
|
|
|
isBefore: (dateA, dateB) => dayjs(dateA).isBefore(dateB),
|
|
|
|
},
|
2021-01-03 21:53:51 +00:00
|
|
|
beforeCreate() {
|
|
|
|
this.uid = uid;
|
|
|
|
uid += 1;
|
|
|
|
},
|
2020-05-14 02:26:05 +00:00
|
|
|
});
|
|
|
|
|
2020-12-26 22:51:27 +00:00
|
|
|
app.directive('tooltip', {
|
|
|
|
beforeMount(el, binding) {
|
|
|
|
// console.log(binding.modifiers);
|
|
|
|
el.title = binding.value; // eslint-disable-line no-param-reassign
|
2020-07-19 01:52:36 +00:00
|
|
|
},
|
|
|
|
});
|
2020-05-14 02:26:05 +00:00
|
|
|
|
2020-12-26 22:51:27 +00:00
|
|
|
app.mount('#container');
|
2019-06-03 03:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
init();
|