zoukankan      html  css  js  c++  java
  • 用户新开游览器重复登录的时候给于提示

    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
                    });
     
            }
          }
        };
    

      

  • 相关阅读:
    odoo service error 更改端口号
    unique 唯一约束
    odoo 注册失败
    odoo 某个字段权限设置
    linux 定时任务
    odoo webside theme
    js 杂记
    vue3入门总结
    vue输出空格
    css等比例缩放图片
  • 原文地址:https://www.cnblogs.com/yuri2016/p/12936465.html
Copyright © 2011-2022 走看看