yunohost-admin/app/src/main.js

65 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-07-06 19:08:34 +02:00
import Vue from 'vue'
import App from './App.vue'
2020-08-29 19:05:56 +02:00
import BootstrapVue from 'bootstrap-vue'
2021-08-14 14:37:19 +02:00
import VueShowdown from 'vue-showdown'
2020-08-29 19:05:56 +02:00
import i18n from './i18n'
2020-08-29 19:05:56 +02:00
import router from './router'
import store from './store'
import { registerGlobalErrorHandlers } from './api'
2020-07-06 19:08:34 +02:00
Vue.config.productionTip = false
2020-08-29 19:05:56 +02:00
// Styles are imported in `src/App.vue` <style>
Vue.use(BootstrapVue, {
BSkeleton: { animation: 'none' },
BAlert: { show: true },
BBadge: { pill: true },
BModal: {
bodyBgVariant: 'warning',
centered: true,
bodyClass: ['font-weight-bold', 'rounded-top']
}
})
2020-08-29 19:05:56 +02:00
2021-08-14 14:37:19 +02:00
Vue.use(VueShowdown, {
options: {
emoji: true
}
})
// Ugly wrapper for `$bvModal.msgBoxConfirm` to set default i18n button titles
// FIXME find or wait for a better way
Vue.prototype.$askConfirmation = function (message, props) {
return this.$bvModal.msgBoxConfirm(message, {
2021-03-17 15:35:01 +01:00
okTitle: this.$i18n.t('ok'),
cancelTitle: this.$i18n.t('cancel'),
...props
})
}
// Register global components
const requireComponent = require.context('@/components/globals', true, /\.(js|vue)$/i)
// For each matching file name...
requireComponent.keys().forEach((fileName) => {
// Get the component
const component = requireComponent(fileName).default
// Globally register the component
2020-07-15 16:39:24 +02:00
Vue.component(component.name, component)
})
registerGlobalErrorHandlers()
const app = new Vue({
2020-07-15 16:39:24 +02:00
i18n,
router,
store,
render: h => h(App)
})
app.$mount('#app')