自定义页面开发及预览

  • 在src/custom/建立一个login目录,在目录创建一个index.jsx
import React, { useEffect } from "react";
const Login = () => {
  return (
    <div>这是一个登录首页</div>
  );
};
export default Login;
  • 在route目录下面的index.jsx文件中增加login的内容
import React from "react";
import { Route, BrowserRouter, Switch } from "react-router-dom";
import Login from "../login";
const PREFIX = process.env.__CLIENT__
  ? window._baseUrl || ""
  : process.env.PREFIX || "";
const CLIENT = process.env.__CLIENT__;
let DOMAIN_PREFIX = CLIENT ? window._baseUrl || "" : PREFIX || "";
if (DOMAIN_PREFIX === undefined) {
  DOMAIN_PREFIX = "";
}
window.DOMAIN_PREFIX = DOMAIN_PREFIX;
const Router = () => {
  return (
    <BrowserRouter>
      <Switch>
        <Route path={`${DOMAIN_PREFIX}/custom/login`} component={Login} />
      </Switch>
    </BrowserRouter>
  );
};
export default Router;
Copyright © 用友 -【生态技术部】 2021 all right reserved,powered by Gitbook修订时间: 2022-06-09 11:52:49

results matching ""

    No results matching ""