zoukankan      html  css  js  c++  java
  • Ant Design Pro项目打开页设为登录或者其他页面

    Ant Design Pro项目打开页设为登录或者其他页面

    一、打开页设为登录页

    首先找到utils包中的authority文件,在该文件中找到如下代码:

    export function getAuthority(str) {
      // return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
      const authorityString =
        typeof str === 'undefined' ? localStorage.getItem('antd-pro-authority') : str;
      // authorityString could be admin, "admin", ["admin"]
      let authority;
      try {
        authority = JSON.parse(authorityString);
      } catch (e) {
        authority = authorityString;
      }
      if (typeof authority === 'string') {
        return [authority];
      }
      return authority || ['admin'];
    }
    

    将第二行的注释取消,那么打开页就是登录页了,这是权限问题。

    二、打开页设为其他页

    在我们进行网页设计的时候,可能没有后端的提供,这时要想使用ant design pro项目。我们需要跳过登录步骤,直接进到其他页面进行静态的设计,这时可以直接在最后一行改为:

    这里的意思是直接返回类型为admin的用户,这样就可以跳过登录了。

  • 相关阅读:
    webpack初识
    Vue+ElementUi项目实现表格-单行拖拽
    promise/async与await 的执行顺序梳理
    MDN社区
    angularjs中的异步操作
    javascript中的字符串和数组的互转
    angularjs的练习题
    angularjs基础知识
    开发的两种方式
    ASP.NET中的HttpClient发送请求
  • 原文地址:https://www.cnblogs.com/tian874540961/p/10253983.html
Copyright © 2011-2022 走看看