react中遇到的事
发布时间:2020-12-15 20:29:35 所属栏目:百科 来源:网络整理
导读:1.路由跳转问题: ? ? ? ? 。 可以使用标签跳转,如Link .NavLink等。 ? ? ? ? 。 如果组件是在Route中的组件,那么该组件的this.props.history.push()可以设置路由,如果组件不在Route中,那么this.props中没有history对象。 ? ? ? ? 。使用 history模块
1.路由跳转问题: ? ? ? ? 。 可以使用标签跳转,如Link .NavLink等。 ? ? ? ? 。 如果组件是在Route中的组件,那么该组件的this.props.history.push()可以设置路由,如果组件不在Route中,那么this.props中没有history对象。 ? ? ? ? 。使用 history模块 import { createHashHistory } from ‘history‘ const history = createHashHistory() ReactDOM.render(<Router history={history} routes={routes}></Router>,...) 2.组件上不能加clssName,加clssName无效。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |