import React, {Component} from 'react';import { NavLink,Link } from "react-router-dom";import './index.less';import PropTypes from 'prop-types'; //这里是重点import logo from '../../images/hyzklogo.png';import logoName from '../../images/logo_name.png';export default class Header extends Component { static contextTypes = { //这里是重点 router: PropTypes.object.isRequired, } constructor(props) { super(props); this.state = { keyword:"" }; this.handleToSearch=this.handleToSearch.bind(this); this.handleChange=this.handleChange.bind(this); } handleChange(event) { this.setState({keyword: event.target.value}); } handleToSearch() { this.context.router.history.push(`/news_list/search/${this.state.keyword}`) //这里是重点,实现跳转 } render() { return (); }}
首页 智库概况 专家团队