作者:mobiledu2402852413 | 来源:互联网 | 2023-09-23 14:54
- react-router 3.0.1 我配置的路由,用 跳转失败, 页面url地址变了,可是视图不变,浏览器也没有报错,不知道什么原因求大神看一下!
2.代码
app.jsx
1 2 3 4 5 6 7 8 9
| import React from 'react';
import ReactDOM from 'react-dom';
import {hashHistory, Router, Route, Link } from 'react-router';
import routes from "./Routes/routes";
ReactDOM.render((
), document.getElementById("myApp")); |
routes.jsx 路由配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| import React from 'react';
import ReactDOM from 'react-dom';
import {Route, Link ,IndexRoute} from 'react-router';
import App from "@/Module/index";
import Goods from "@/Module/goods";
let routes = (
);
export default routes; |
header.jsx 导航跳转
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| import React from 'react';
import {Link } from 'react-router';
import "./style/header.less";
import NavLink from "./NavLink";
class Header extends React.Component {
constructor(props){
super(props);
this.item = [];
}
render() {
return (
);
}
}
export default Header; |
NavLink.jsx
1 2 3 4 5 6 7 8 9 10 11
| import React from 'react';
import { Link } from 'react-router';
class NavLink extends React.Component {
render() {
return ()
}
};
export default NavLink; |
源码我已经发到github里面了: 大神帮我看看是什么问题https://github.com/w3cui/reac...