React页面地图—— react router4.0

react router

yarn add react-router-dom


	import Home from '../pages/home'
	import Article from '../pages/article'
	
	import User from '../pages/user'
	import Role from '../pages/role'
	
	const routers = [
	    { key:"1", path: "/", name: "首页", component: Home },
	    { key:"2", path: "/article-edit", name: "笔记", component: Article },
	    { key:"3", path: "/note-type", name: "类型", component: Article },
	    { key:"4", path: "/auth/user", name: "用户", component: User },
	    { key:"5", path: "/auth/role", name: "角色", component: Role }
	];
	export default routers;

	import React from 'react';
	import {HashRouter, Route, Switch,Redirect } from 'react-router-dom';
	
	import App from '../App';
	import Login from '../pages/login';
	import Admin from '../pages/admin';
	import Routers from './routers'
	
	// import Home from '../pages/home'
	// import Miss404 from '../pages/404';
	
	class LvxRouter extends React.Component {
	
	    render(){
	        return (
	            
	                
	                    
    
	                        
	                        
	                            
	                                
     
      
	                                    {
	                                        Routers.map((item, index)=>{
	                                            return  (true ? 
     
    

你可能感兴趣的:(JavaScript)