获取浏览器cookies属性值

// 调用函数
    let  AdminName = this.getCookie(属性名字);
    let  AdminName = this.getCookie('AdminName=nature');
    let  AdminPwd = this.getCookie('AdminPwd=nature');

getCookie(cname)
    {
      var name = cname + "=";
      var ca = document.cookie.split(';');
      for(var i=0; i<ca.length; i++)
      {
        var c = ca[i].trim();
        if (c.indexOf(name)==0) return c.substring(name.length,c.length);
      }
      return "";
    }

你可能感兴趣的:(js)