1

我正在使用 reactstrapBreadcrumb组件如下:

<Breadcrumb tag="nav" className="relay-breadcrumb">
  <BreadcrumbItem tag="a" href="#">Dashboard</BreadcrumbItem>
  <BreadcrumbItem tag="a" href="#">Channels</BreadcrumbItem>
  <BreadcrumbItem tag="a" href="#">{match.params.channelName}</BreadcrumbItem>
  <BreadcrumbItem active >{match.params.videoName}</BreadcrumbItem>
</Breadcrumb>

当我给出这样的值时:

href={`/dashboard/channels/${{match.params.channelName}`}}

...重定向似乎有效,但整个页面重新加载。请提出更好的替代方案。

4

1 回答 1

0

使用history.push()RRv4 的 API:

<Breadcrumb tag="nav" className="relay-breadcrumb">
  <BreadcrumbItem
    tag="a"
    onClick={() => this.props.history.push(`/dashboard/channels/${match.params.channelName}`)}
  >
    Dashboard
  </BreadcrumbItem>
  {
    /* ....*/
  }
</Breadcrumb>
于 2018-03-09T10:43:22.447 回答