40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import {GlobalStore} from './lib/gstore'
|
|
import VueRouter from 'vue-router'
|
|
import routes from './routes'
|
|
|
|
|
|
window.gs = new GlobalStore();
|
|
|
|
/* (1) Global data
|
|
---------------------------------------------------------*/
|
|
/* (1) Get Full URI */
|
|
gs.set('URI', document.URL.replace(/^(?:[^\/]+\/\/|[^\/]+\/)/, '').split('/').filter(function(v,i){ return !!i && v.length; }));
|
|
|
|
/* (2) Store routes */
|
|
gs.set('routes', routes[0]);
|
|
|
|
/* (3) Init. vue router */
|
|
gs.set('router', new VueRouter({
|
|
routes: gs.get.routes
|
|
}));
|
|
|
|
|
|
|
|
|
|
/* (2) Main components
|
|
---------------------------------------------------------*/
|
|
/* (1) Menu - channel list */
|
|
gs.set('channel', {
|
|
list: {
|
|
me: { label: '0 online', icon: 'group' },
|
|
test1: { label: null, icon: '' },
|
|
test2: { label: null, icon: '' },
|
|
add: { label: null, icon: 'add', add: 1 }
|
|
},
|
|
|
|
active: 'me'
|
|
});
|
|
|
|
/* (2) Set current active menu item from URL */
|
|
if( gs.get.URI.length > 1 && gs.get.channel.list.hasOwnProperty(gs.get.URI[gs.get.URI.length-1]) )
|
|
gs.get.channel.active = gs.get.URI[gs.get.URI.length-1]; |