Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
main.js 1.35 KiB
import {createApp} from 'vue';
import {createBootstrap} from 'bootstrap-vue-next';
// on met en place le client d'UnicaenVue
import unicaenVue from './unicaenVue';
function init(vues, options)
{
const components = {}
if (undefined === options){
options = {};
}
for (const path in vues) {
let compPath = path.slice(2, -4);
let compName = compPath.replaceAll('/', '');
components[compName] = vues[path].default;
}
// instantiate the Vue apps
// Note our lookup is a wrapping div with .vue-app class
for (const el of document.getElementsByClassName('vue-app')) {
let app = createApp({
template: el.innerHTML,
components: components
});
if (undefined !== options.beforeMount){
options.beforeMount(app);
}
//autoload de tous les composants déclarés
if (undefined !== options.autoloads){
for (const alias in options.autoloads) {
let compName = options.autoloads[alias].replaceAll('/', '');
app.component(alias, components[compName]);
}
}
app.use(createBootstrap({components: true, directives: true}))
app.mount(el);
if (undefined !== options.afterMount){
options.afterMount(app);
}
}
}
export default {
init
}