类组件

const history = createBrowserHistory({
  forceRefresh: true // 这个表示url更新会刷新页面,如果不添加不刷新 当然你也可以用js刷新 哪个效率高还没研究过
});
// 之后 定义方法触发即可
  goSearch(a) {
    history.push(`/search?drug=${a}`);
  }

函数式组件

const history = useHistory();
history.push(`'/search?a=${value}'`)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-01-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案