frontend/src/main.js

69 lines
2.3 KiB
JavaScript
Raw Normal View History

2021-01-15 23:24:15 +11:00
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
2021-01-18 00:05:28 +11:00
import Buefy, {Snackbar} from 'buefy'
2021-01-15 23:24:15 +11:00
import axios from 'axios'
import VueAxios from 'vue-axios'
2021-01-16 17:06:35 +11:00
import i18n from './i18n'
import moment from 'moment'
2021-02-02 23:44:45 +11:00
import VMdEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import enUS from '@kangc/v-md-editor/lib/lang/en-US';
import createHljsTheme from '@kangc/v-md-editor/lib/theme/hljs';
import json from 'highlight.js/lib/languages/json';
const hljsTheme = createHljsTheme();
import io from 'socket.io-client'
import VueSocketIO from "vue-socket.io";
2021-02-04 18:23:11 +11:00
import NProgress from "vue-nprogress";
Vue.use(NProgress)
const nprogress = new NProgress()
2021-02-02 23:44:45 +11:00
Vue.use(
new VueSocketIO({
debug: true,
connection: io(process.env.VUE_APP_GATEWAYENDPOINT), // options object is Optional
})
);
Vue.use(VMdEditor)
VMdEditor.lang.use('en-US', enUS);
hljsTheme.extend((md, hljs) => {
md.set({
html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />).
// This is only for full CommonMark compatibility.
breaks: true, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be
// useful for external highlighters.
linkify: true, // Autoconvert URL-like text to links
image: false,
// Enable some language-neutral replacement + quotes beautification
typographer: true,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array.
//
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
// and ['«\xA0', '\xA0»', '\xA0', '\xA0'] for French (including nbsp).
quotes: '“”‘’'
})
md.disable('image')
hljs.registerLanguage('json', json);
});
2021-01-15 23:24:15 +11:00
Vue.use(VueAxios, axios)
Vue.use(Buefy)
Vue.config.productionTip = false
2021-01-18 00:05:28 +11:00
Vue.prototype.$snackbar = Snackbar
Vue.filter('formatDate', function(value) {
if (value) {
return moment(String(value)).format('hh:mm A, DD/MM/YYYY')
}
})
2021-01-15 23:24:15 +11:00
new Vue({
2021-02-04 18:23:11 +11:00
nprogress,
2021-01-15 23:24:15 +11:00
router,
store,
2021-01-16 17:06:35 +11:00
i18n,
2021-01-15 23:24:15 +11:00
render: h => h(App)
}).$mount('#app')