Skip to content
Snippets Groups Projects
Select Git revision
  • d17bc60e71bc12c3f067a7a0140206a32c36bb71
  • main default protected
  • php84
  • 5x
  • 6.1.6
  • 6.1.5
  • 6.1.4
  • 6.1.3
  • 6.1.2
  • 6.1.1
  • 6.1.0
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 6.0.0
  • 5.0.3
  • 5.0.2
  • 5.0.1
  • 4.0.1
  • 5.0.0
  • 4.0.0
21 results

Module.php

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
    }