apple2026
V2EX  ›  Next.js

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

  •  
  •   apple2026 · Dec 1, 2021 · 2878 views
    This topic created in 1740 days ago, the information mentioned may be changed or developed.
    apple2026
        1
    apple2026  
    OP
       Dec 1, 2021
    找到答案了

    ```
    import Router from 'next/router'

    Router.push('/')
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   952 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:24 · PVG 02:24 · LAX 11:24 · JFK 14:24
    ♥ Do have faith in what you're doing.