V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sciel
V2EX  ›  Next.js

nextjs 类里面如何跳转路由呢?类里面不能使用 useRouter

  •  
  •   sciel · 2021-12-01 13:25:29 +08:00 · 1975 次点击
    这是一个创建于 849 天前的主题,其中的信息可能已经有所发展或是发生改变。
    sciel
        1
    sciel  
    OP
       2021-12-01 13:39:36 +08:00
    找到答案了

    ```
    import Router from 'next/router'

    Router.push('/')
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2924 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:10 · PVG 19:10 · LAX 04:10 · JFK 07:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.