fix: view.vue-config|view.main (do not show notification if already on the target page)
This commit is contained in:
parent
3fd5fdfa97
commit
fe1ab69cf0
|
@ -42,6 +42,8 @@ new Vue({
|
|||
render: h => h(wrapper_vue)
|
||||
});
|
||||
|
||||
gstore.data.func.nav(router, null);
|
||||
|
||||
|
||||
/* (3) Set WebSocket channels
|
||||
---------------------------------------------------------*/
|
||||
|
@ -63,6 +65,9 @@ window.wsc_connect = wsc.channel('connect').listen(function(msg, err){
|
|||
gstore.data.notif[0].count += msg.connected.length;
|
||||
}
|
||||
|
||||
// {4} Reset notification count if already on page //
|
||||
gstore.data.func.nav(router, null);
|
||||
|
||||
}).send({name: _SERVER.session.name});
|
||||
|
||||
|
||||
|
@ -84,6 +89,10 @@ window.wsc_chat = wsc.channel('chat').listen(function(msg, err){
|
|||
gstore.data.notif[1].count += msg.msg.length
|
||||
}
|
||||
|
||||
// {4} Reset notification count if already on page //
|
||||
gstore.data.func.nav(router, null);
|
||||
|
||||
|
||||
}).send({name: _SERVER.session.name});
|
||||
|
||||
|
||||
|
|
|
@ -52,12 +52,21 @@ gstore.add('func', {
|
|||
nav: function(router, uri){
|
||||
|
||||
// {1} Update view (vue-router) //
|
||||
router.push('/'+uri);
|
||||
if( typeof uri == 'string' )
|
||||
router.push('/'+uri);
|
||||
|
||||
// {2} Activate current menu_item //
|
||||
// {2} if no @uri -> Extract route from @router //
|
||||
else if( /^\/([^\/]+).*$/.test( router.app.$route.path ) )
|
||||
uri = RegExp.$1;
|
||||
|
||||
// {3} If no @uri -> exit //
|
||||
else
|
||||
return;
|
||||
|
||||
// {4} Activate current menu_item //
|
||||
gstore.data.menu_item_active = uri;
|
||||
|
||||
// {3} Manage notifications //
|
||||
// {5} Manage notifications //
|
||||
for( var notif of gstore.data.notif )
|
||||
if( notif.link == uri ) // if notif links to current page
|
||||
notif.count = 0;
|
||||
|
|
Loading…
Reference in New Issue