Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 例如Redux系统,这样您就可以分派简单的操作来打开/关闭它。您能解释一下您真正想要实现的目标吗?我想使用诸如(家长注册、学生注册)等选项的侧菜单打开对话框(用户注册表)。该对话框应在当前url中…非常感谢…是否有任何可能在没有警报框的情况下工作…抱歉…我_Reactjs - Fatal编程技术网

Reactjs 例如Redux系统,这样您就可以分派简单的操作来打开/关闭它。您能解释一下您真正想要实现的目标吗?我想使用诸如(家长注册、学生注册)等选项的侧菜单打开对话框(用户注册表)。该对话框应在当前url中…非常感谢…是否有任何可能在没有警报框的情况下工作…抱歉…我

Reactjs 例如Redux系统,这样您就可以分派简单的操作来打开/关闭它。您能解释一下您真正想要实现的目标吗?我想使用诸如(家长注册、学生注册)等选项的侧菜单打开对话框(用户注册表)。该对话框应在当前url中…非常感谢…是否有任何可能在没有警报框的情况下工作…抱歉…我,reactjs,Reactjs,例如Redux系统,这样您就可以分派简单的操作来打开/关闭它。您能解释一下您真正想要实现的目标吗?我想使用诸如(家长注册、学生注册)等选项的侧菜单打开对话框(用户注册表)。该对话框应在当前url中…非常感谢…是否有任何可能在没有警报框的情况下工作…抱歉…我在stackover flow中又问了一个问题…请参见此…………@ManuPanduu是的,您可以随心所欲。这只是演示如何处理与对话框交互的每个场景。 import React from "react"; import "./styles.cs


例如Redux系统,这样您就可以分派简单的操作来打开/关闭它。

您能解释一下您真正想要实现的目标吗?我想使用诸如(家长注册、学生注册)等选项的侧菜单打开对话框(用户注册表)。该对话框应在当前url中…非常感谢…是否有任何可能在没有警报框的情况下工作…抱歉…我在stackover flow中又问了一个问题…请参见此…………@ManuPanduu是的,您可以随心所欲。这只是演示如何处理与对话框交互的每个场景。
import React from "react";
import "./styles.css";
import { BrowserRouter, Route, Switch } from "react-router-dom";
import Home from "./home";
import About from "./about";
import Dialog from "./dialog";
import SideMenu from "./sidemu";
export default function App() {
  return (
    <div className="App">
      <BrowserRouter>

      <SideMenu />
        {/* <Switch> */}
          <Route exact path="/" component={Home} />
          <Route exact path="/about" component={About} />
          <Route exact path="/sidemenu" component={SideMenu} />
          <Route exact path="/dialog" component={Dialog} />
        {/* </Switch> */}
      </BrowserRouter>
      {/* <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2> */}
    </div>
  );
}
import React, { Component } from "react";

class Home extends Component {
  render() {
    return (
      <div>
        <div>Home</div>
      </div>
    );
  }
}

export default Home;
import React, { Component } from "react";

class Home extends Component {
  render() {
    return (
      <div>
        <div>about us</div>
      </div>
    );
  }
}

export default Home;
import React from 'react';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogTitle from '@material-ui/core/DialogTitle';

export default function AlertDialog() {
  const [open, setOpen] = React.useState(false);

  const handleClickOpen = () => {
    setOpen(true);
  };

  const handleClose = () => {
    setOpen(false);
  };

  return (
    <div>
      <Button variant="outlined" color="primary" onClick={handleClickOpen}>
        Open alert dialog
      </Button>
      <Dialog
        open={true}
        onClose={handleClose}
        aria-labelledby="alert-dialog-title"
        aria-describedby="alert-dialog-description"
      >
        <DialogTitle id="alert-dialog-title">{"Use Google's location service?"}</DialogTitle>
        <DialogContent>
          <DialogContentText id="alert-dialog-description">
            Let Google help apps determine location. This means sending anonymous location data to
            Google, even when no apps are running.
          </DialogContentText>
        </DialogContent>
        <DialogActions>
          <Button onClick={handleClose} color="primary">
            Disagree
          </Button>
          <Button onClick={handleClose} color="primary" autoFocus>
            Agree
          </Button>
        </DialogActions>
      </Dialog>
    </div>
  );
}
import React from 'react';
import './styles.css';
import { Link } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer';
import { List, ListItemIcon, ListItem, ListItemText } from '@material-ui/core';
import MenuRoundedIcon from '@material-ui/icons/MenuRounded';
import HomeRoundedIcon from '@material-ui/icons/HomeRounded';
import MenuBookRoundedIcon from '@material-ui/icons/MenuBookRounded';

const useStyles = makeStyles({
  list: {
    width: 250,
  },
  fullList: {
    width: 'auto',
  },
});

export default function TemporaryDrawer() {
  const classes = useStyles();
  const [state, setState] = React.useState({
    top: false,
    left: false,
    bottom: false,
    right: false,
  });

  const toggleDrawer = (side, open) => event => {
    if (event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) {
      return;
    }

    setState({ ...state, [side]: open });
  };

  const sideList = side => (
    <div
      className={classes.list}
      role="presentation"
      onClick={toggleDrawer(side, false)}
      onKeyDown={toggleDrawer(side, false)}
    >
      <List>
        <Link className="right-menu-data" to="/">
          <ListItem button>
            <ListItemIcon>
              <HomeRoundedIcon />
            </ListItemIcon>
            <ListItemText>Home</ListItemText>
          </ListItem>
        </Link>
        <Link className="right-menu-data" to="/about"><ListItem button>
          <ListItemIcon>
            <MenuBookRoundedIcon />
          </ListItemIcon>
          <ListItemText>About us</ListItemText>
        </ListItem>
        </Link>
        <Link className="right-menu-data" to="/dialog"><ListItem button>
          <ListItemIcon>
            <MenuBookRoundedIcon />
          </ListItemIcon>
          <ListItemText>User Registration</ListItemText>
        </ListItem>
        </Link>
      </List>


    </div>
  );


  return (
    <div>
      <MenuRoundedIcon className="careerpedia-menu-bars" onClick={toggleDrawer('right', true)} />
      <Drawer anchor="right" open={state.right} onClose={toggleDrawer('right', false)}>
        {sideList('right')}
      </Drawer>
    </div>
  );
}
const AlertDialog = ({ open, onAgree, onClose, onDisagree }) => (
  <Dialog
    open={open}
    onClose={onClose}
    aria-labelledby="alert-dialog-title"
    aria-describedby="alert-dialog-description"
  >
    <DialogTitle id="alert-dialog-title">
      {"Use Google's location service?"}
    </DialogTitle>
    <DialogContent>
      <DialogContentText id="alert-dialog-description">
        Let Google help apps determine location. This means sending anonymous
        location data to Google, even when no apps are running.
      </DialogContentText>
    </DialogContent>
    <DialogActions>
      <Button onClick={onDisagree} color="primary">
        Disagree
      </Button>
      <Button onClick={onAgree} color="primary" autoFocus>
        Agree
      </Button>
    </DialogActions>
  </Dialog>
);
export default function App() {
  const [open, setOpen] = useState(false);

  const openDialog = () => setOpen(true);
  const closeDialog = () => setOpen(false);

  const onAgreeHandler = () => {
    closeDialog();
    alert("AGREED");
  };
  const onDisgreeHandler = () => {
    closeDialog();
    alert("DISAGREED");
  };
  const onCloseHandler = (event, reason) => {
    closeDialog();
    alert(`Dialog closed. Reason: ${reason}`);
  };

  return (
    <div className="App">
      <BrowserRouter>
        <SideMenu openDialog={openDialog} /> // Pass dialog open callback to sidemenu
        <Route exact path="/" component={Home} />
        <Route exact path="/about" component={About} />
        <Route exact path="/dialog" component={Dialog} />
      </BrowserRouter>

      <Button variant="outlined" color="primary" onClick={openDialog}>
        Open alert dialog test
      </Button>

      <Dialog
        open={open}
        onAgree={onAgreeHandler}
        onClose={onCloseHandler}
        onDisagree={onDisgreeHandler}
      />
    </div>
  );
}
export default function TemporaryDrawer({ openDialog }) { // Accept openDialog callback

  ...
    { /* Add new menu list item (not in a Link!) */ }
    <ListItem button onClick={openDialog}> // Set onClick handler to openDialog callback
      <ListItemIcon>
        <MenuBookRoundedIcon />
      </ListItemIcon>
      <ListItemText>Trigger dialog?</ListItemText>
    </ListItem>