ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.51k stars 8.15k forks source link

🐛[BUG] hideNav 无效 #6973

Closed leesama closed 4 years ago

leesama commented 4 years ago

今天看见最新版本修复了该问题,重装依赖后,发现原本正常的chrome也无效了。 @chenshuai2144

chenshuai2144 commented 4 years ago

show 一下你的配置

leesama commented 4 years ago

{ "name": "ant-design-pro", "version": "5.0.0-alpha.0", "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { "analyze": "cross-env ANALYZE=1 umi build", "build": "umi build && node publish-to-dev.js", "publish-to-dev": "node publish-to-dev.js", "deploy": "npm run site && npm run gh-pages", "dev": "npm run start:dev", "gh-pages": "cp CNAME ./dist/ && gh-pages -d dist", "i18n-remove": "pro i18n-remove --locale=zh-CN --write", "postinstall": "umi g tmp", "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier", "lint-staged": "lint-staged", "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:prettier": "prettier --check \"/*\" --end-of-line auto", "lint:style": "stylelint --fix \"src/*/.less\" --syntax less", "prettier": "prettier -c --write \"/*\"", "start": "cross-env UMI_UI=none umi dev", "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none umi dev", "start:no-mock": "cross-env MOCK=none UMI_UI=none umi dev", "start:no-ui": "cross-env UMI_UI=none umi dev", "start:pre": "cross-env REACT_APP_ENV=pre umi dev", "start:test": "cross-env REACT_APP_ENV=test MOCK=none umi dev", "pretest": "node ./tests/beforeTest", "test": "umi test", "test:all": "node ./tests/run-tests.js", "test:component": "umi test ./src/components", "tsc": "tsc" }, "lint-staged": { "/*.less": "stylelint --syntax less", "*/.{js,jsx,ts,tsx}": "npm run lint-staged:js", "/*.{js,jsx,tsx,ts,less,md,json}": [ "prettier --write" ] }, "browserslist": [ "> 1%", "last 2 versions", "not ie <= 10" ], "dependencies": { "@ant-design/icons": "^4.0.0", "@ant-design/pro-layout": "^6.0.0-2", "@ant-design/pro-table": "^2.3.1", "@types/crypto-js": "^3.1.47", "@umijs/hooks": "^1.9.2", "antd": "^4.0.0", "classnames": "^2.2.6", "crypto-js": "^4.0.0", "dayjs": "^1.8.28", "file-saver": "^2.0.2", "js-cookie": "^2.2.1", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", "moment": "^2.25.3", "omit.js": "^1.0.2", "qs": "^6.9.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-images": "^1.1.7", "react-quill": "2.0.0-beta.2", "react-use": "^15.1.1", "store2": "^2.11.2", "umi": "^3.1.0", "umi-request": "^1.0.8", "use-merge-value": "^1.0.1" }, "devDependencies": { "@ant-design/pro-cli": "^2.0.2", "@types/classnames": "^2.2.7", "@types/express": "^4.17.0", "@types/file-saver": "^2.0.1", "@types/history": "^4.7.2", "@types/jest": "^25.1.0", "@types/lodash": "^4.14.144", "@types/node": "^14.0.6", "@types/qs": "^6.5.3", "@types/react": "^16.9.17", "@types/react-dom": "^16.8.4", "@types/react-helmet": "^5.0.13", "@types/webpack-env": "^1.15.2", "@umijs/fabric": "^2.0.5", "@umijs/plugin-blocks": "^2.0.5", "@umijs/plugin-esbuild": "^1.0.0-beta.2", "@umijs/preset-ant-design-pro": "^1.2.0", "@umijs/preset-react": "^1.4.24", "@umijs/preset-ui": "^2.1.11", "carlo": "^0.9.46", "cross-env": "^7.0.0", "cross-port-killer": "^1.1.1", "detect-installer": "^1.0.1", "eslint": "^6.8.0", "express": "^4.17.1", "ftp-deploy": "^2.3.7", "gh-pages": "^2.0.1", "husky": "^4.0.7", "lint-staged": "^10.0.0", "mockjs": "^1.0.1-beta3", "prettier": "^2.0.1", "pro-download": "1.0.1", "puppeteer-core": "^2.1.1", "stylelint": "^13.0.0" }, "engines": { "node": ">=10.0.0" }, "__npminstall_done": false } ``

xiaohuoni commented 4 years ago

@leesama 应该是config配置

leesama commented 4 years ago

`// https://umijs.org/config/ import { defineConfig } from 'umi'; import defaultSettings from './defaultSettings'; import proxy from './proxy'; import routes from './route'; const { REACT_APP_ENV } = process.env;

export default defineConfig({ hash: true, antd: {}, dva: { hmr: true, }, layout: { locale: true, }, locale: { // default zh-CN default: 'zh-CN', // default true, when it is true, will use navigator.language overwrite default antd: true, baseNavigator: true, }, dynamicImport: { loading: '@/components/PageLoading/index', }, targets: { ie: 11, }, // umi routes: https://umijs.org/docs/routing routes, // Theme for antd: https://ant.design/docs/react/customize-theme-cn // 全局less变量 theme: { // 颜色逐渐加深 'black-1': '#666666FF', 'black-2': '#333333', 'primary-color': defaultSettings.primaryColor, }, ignoreMomentLocale: true, proxy: proxy[REACT_APP_ENV || 'dev'], manifest: { basePath: '/', }, }); `

leesama commented 4 years ago

`export default { navTheme: "light", primaryColor: "#26B0A8", layout: "mix", logo: false,

contentWidth: "Fluid", fixedHeader: false, autoHideHeader: false, fixSiderbar: false, colorWeak: false, menu: { locale: true }, siderWidth: 201, menuProps: { openKeys }, loading: false, title: "终端机管理系统", pwa: false, iconfontUrl: "", } as LayoutSettings & { pwa: boolean; }; `

chenshuai2144 commented 4 years ago

routes 的配置最重要

leesama commented 4 years ago
// 路由配置
// cicon中传入menuicon文件夹中的文件名作为菜单图标
export default [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    name: 'home',
    cicon: 'icon_shouye',
    component: './home/home',
    access: 'canReadPageHome',
  },
  {
    hideInMenu: true,
    path: '/home/announcement',
    name: 'home-announcement',
    component: './home/announcement',
  },
  {
    path: '/login',
    hideInMenu: true,
    layout: false,
    name: 'login',
    component: './login',
  },
  {
    path: '/product',
    name: 'product',
    cicon: 'icon_chanping',
    access: 'canReadPageProduct',
    routes: [
      {
        path: '/product/list',
        access: 'canReadPageProductList',
        name: 'product-list',
        component: './product/list',
      },
      {
        path: '/product/record',
        access: 'canReadPageProductRecord',
        name: 'product-record',
        component: './product/record',
      },
    ],
  },
  {
    path: '/opportunity',
    name: 'opportunity',
    cicon: 'icon_shangji',
    access: 'canReadPageOpportunity',
    routes: [
      {
        path: '/opportunity/list',
        name: 'opportunity-list',
        access: 'canReadPageOpportunityList',
        component: './opportunity/list',
      },
    ],
  },
  {
    path: '/content',
    name: 'content',
    cicon: 'icon_neirong',

    access: 'canReadPageContent',
    routes: [
      {
        path: '/content/enterprise',
        name: 'content-enterprise',
        access: 'canReadPageContentEnterprise',
        component: './content/enterprise',
      },
      {
        path: '/content/ad',
        name: 'content-ad',
        access: 'canReadPageContentAd',
        component: './content/ad',
      },
    ],
  },
  {
    path: '/terminal',
    name: 'terminal',
    cicon: 'icon_zhongduan',
    access: 'canReadPageTerminal',
    routes: [
      {
        path: '/terminal/list',
        name: 'terminal-list',
        access: 'canReadPageTerminalList',
        component: './terminal/list',
      },
    ],
  },
  {
    path: '/account',
    name: 'account',
    cicon: 'icon_zhanghao',
    access: 'canReadPageAccount',
    routes: [
      {
        path: '/account/organization',
        name: 'account-organization',
        access: 'canReadPageAccountOrganization',
        component: './account/organization',
      },
      {
        path: '/account/list',
        name: 'account-list',
        access: 'canReadPageAccountList',
        component: './account/list',
      },
      {
        path: '/account/roleList',
        name: 'account-roleList',
        access: 'canReadPageAccountRoleList',
        component: './account/roleList',
      },
    ],
  },
  // {
  //   path: "/aaa",
  //   name: "aaa",
  //   // cicon: "icon_zhongduan",
  //   routes: [
  //     {
  //       path: "/aaa/list",
  //       name: "aa",
  //       // access: "canReadPageTerminalList",
  //       component: "./ListTableList",
  //     },
  //   ],
  // },
  {
    component: './404',
  },
];
leesama commented 4 years ago

配置得按照umi文档重新填,更新也太快了