nextJS 深度动态路由 [英] nextJS deep dynamic routing

查看:56
本文介绍了nextJS 深度动态路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 NextJS 进行开发时,我有一个问题.
要使用动态路由,我们编写类似 [id].js
的文件当我的目录结构是这样的:

 ㄴ区
  ㄴ [区域].js ,br/>

While I'm developing with NextJS, I have a question.
To Use dynamic routing, we write file like [id].js
When my directory structure is like this:
pages
 ㄴ area
   ㄴ [area].js ,br/>

页面示例类似于area/texas"或area/newyork"

page example is like 'area/texas' or 'area/newyork'

我想将动态路由加倍,例如area/texas/houston"或area/texas/dallas"
(页面/区域/区域,区域和区域可以改变)
但我不知道如何制作文件结构
我尝试了几种方法,但失败了:-(

让我知道,如何制作结构!!

I want to double dynamic routing like 'area/texas/houston' or 'area/texas/dallas'
(page/area/region, area and region can change)
But I don't know how to make file structure
I tried a few way, I failed :-(

Let me know, how to make structure!!

推荐答案

只需将 [area].js 重命名为 [...area].js

Just rename [area].js to [...area].js

这篇关于nextJS 深度动态路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆