Skip to content
Snippets Groups Projects
Select Git revision
  • 37af655990b1bb3ad7187a21528a236a7f55ee2b
  • master default protected
  • detached4
  • detached3
  • detached2
  • bsv-next
  • detached
  • php82
  • 6.x
  • 6.4.0
  • 6.3.3
  • 6.3.2
  • 6.3.1
  • 6.3.0
  • 6.2.7
  • 6.2.6
  • 6.2.5
  • 6.2.4
  • 6.2.3
  • 6.2.2
  • 6.2.1
  • 6.2.0
  • 6.1.3
  • 6.1.2
  • 6.1.1
  • 6.1.0
  • 6.0.0
27 results

main.js

Blame
  • 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
    }