• umijs 配置的一些用法和解释 记录


    .umirc中配置和解释:

    设置请求代理:可以将当前访问域名的请求转发到指定域名下。用于跨域代理开发,开发完后放入指定服务器中。

    //请求代理
      proxy: {
        '/api': {
          target: 'http://localhost:3000',
          changeOrigin: true,
          pathRewrite: {
            '^/api/': '/api/',
          },
        },
      },

    打包和运行到指定目录

    base和publicPath一般一样,指向css和js文件路径,outoutPath是打包的文件放在哪个目录中

    //运行到某个目录中
      base: '/timeaxis_web/',
      publicPath: '/timeaxis_web/',
      outputPath: '/timeaxis_web/',

    配置为hash路由

      history: {
        type: 'hash',
      },

    静态路由,可以打包出history路由的页面配置

    exportStatic: {}, //静态路由

    用于配置路由,如果不写就是自动路由,写了之后自动路由无效了

      routes: [
        {
          path: '/preview',
          component: '../pages/preview',
        },
      ],

    适配ie11

      targets: {
        ie: 11,
      },

    开启dva、antd等功能

      antd: {},
      dva: {
        hmr: true,
      },
      locale: {
        default: 'zh-CN',
        antd: true,
        baseNavigator: true,
      },

    重定向到某个页面 重定向到/home

    import { Redirect } from 'umi';
    
    <Redirect to="/home" />

    欢迎一起交流!
    【http://wuhairui.cnblogs.com/】

  • 相关阅读:
    curl crt
    test with nmap
    C#查询XML解决“需要命名空间管理器”问题
    Dapper实用教程
    javascript 计算两个日期的差值
    Glib学习笔记(二)
    安装osquery笔记
    Golang多线程简单斗地主
    PHP扩展开发之Zephir
    zabbix 安装记录
  • 原文地址:https://www.cnblogs.com/wuhairui/p/15007544.html
Copyright © 2020-2023  润新知