no message
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import React,{Component} from 'react'
|
||||
import {NavLink,Route,Routes,Navigate,useRoutes} from 'react-router-dom'
|
||||
import routes from './router';
|
||||
// import routes from './router';
|
||||
import Head from "./pages/head"
|
||||
import './pages/style.scss'
|
||||
import elementArr from './router/element';
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
import { func } from "prop-types";
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
// import {withRouter} from "react-router-dom";
|
||||
class Head extends React.Component{
|
||||
back=()=>{
|
||||
// this.props.history.goBack()
|
||||
// function navigate_(){
|
||||
// const navigate=useNavigate()
|
||||
// navigate('/github')
|
||||
// }
|
||||
export default function Head(){
|
||||
const navigate = useNavigate()
|
||||
const back=()=>{
|
||||
|
||||
}
|
||||
forward=()=>{
|
||||
// this.props.history.goForward()
|
||||
const forward=()=>{
|
||||
|
||||
}
|
||||
go=()=>{
|
||||
// this.props.history.go(-2)
|
||||
const go=()=>{
|
||||
|
||||
}
|
||||
render(){
|
||||
const go1=()=>{
|
||||
console.log("xxx")
|
||||
navigate('/github')
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="head">
|
||||
<h1>this is Hader</h1>
|
||||
<button onClick={this.back}>返回</button>
|
||||
<button onClick={this.forward}>前进</button>
|
||||
<button onClick={this.go}>退后2步</button>
|
||||
<button onClick={back}>返回</button>
|
||||
<button onClick={forward}>前进</button>
|
||||
<button onClick={go}>退后2步</button>
|
||||
<button onClick={go1}>重定向</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default Head
|
||||
@@ -0,0 +1,6 @@
|
||||
1、NavLink 高亮
|
||||
2、useRoutes函数
|
||||
3、<Routes/>
|
||||
4、重定向
|
||||
<Route path="/" element={<Navigate to="/jsx"/>} />
|
||||
useNavigate 函数
|
||||
Reference in New Issue
Block a user