用户新开浏览器tab重复登录的时候给于提示
const key = `open${Date.now()}`; window.onstorage = function(e) { if(e.key=='username' && e.newValue){ console.log('The ' + e.key + ' key has been changed from ' + e.oldValue + ' to ' + e.newValue + '.'); if(window.APP){ // window.APP.$message.error('Your current account ' + e.oldValue + ' have been logout. '); window.APP.$notification['warning']({ message: 'Notification', class:"warning", placement:"bottomRight", //topLeft topRight bottomLeft bottomRight duration: 0, description:'Your current account ' + e.oldValue + ' have been logout. ', btn: h => { return h( 'a-button', { props: { type: 'primary', size: 'small', }, on: { click: () => { window.APP.$notification.close(key); location.reload(); } }, }, 'Reload', ); }, key:key }); } } };