https://image.wenhaofree.com/2025/06/84543499c9e27ad5d0ed475431ca9953.png

next js之目录结构说明

Next.js 项目结构

本页面提供 Next.js 项目的文件和文件夹结构概述。它涵盖了顶层文件和文件夹、配置文件以及应用程序和页面目录中的路由约定。

顶层文件夹

文件夹名 说明
app 应用程序路由
pages 页面路由
public 静态资源文件夹
src 可选的应用程序源代码文件夹

顶层文件

文件名 说明
Next.js Next.js 运行时文件
next.config.js Next.js 的配置文件
package.json 项目依赖和脚本
instrumentation.ts OpenTelemetry 和 Instrumentation 文件
middleware.ts Next.js 请求中间件
.env 环境变量
.env.local 本地环境变量
.env.production 生产环境变量
.env.development 开发环境变量
.eslintrc.json ESLint 的配置文件
.gitignore Git 忽略的文件和文件夹
next-env.d.ts Next.js 的 TypeScript 声明文件
tsconfig.json TypeScript 的配置文件
jsconfig.json JavaScript 的配置文件

app 路由约定

路由文件

文件名 扩展名 说明
layout .js .jsx .tsx 布局
page .js .jsx .tsx 页面
loading .js .jsx .tsx 加载界面
not-found .js .jsx .tsx 未找到界面
error .js .jsx .tsx 错误界面
global-error .js .jsx .tsx 全局错误界面
route .js .ts API 端点
template .js .jsx .tsx 重新渲染的布局
default .js .jsx .tsx 并行路由回退页面

嵌套路由

  • 使用文件夹表示路由片段

动态路由

  • [folder] 表示动态路由片段
  • […folder] 表示匹配所有路由片段
  • [[…folder]] 表示可选匹配所有路由片段

路由组和私有文件夹

  • (folder) 表示路由组,不影响路由
  • _folder 表示私有文件夹,不参与路由

并行和拦截路由

  • @folder 表示命名插槽
  • (.)folder 表示拦截同级路由
  • (..)folder 表示拦截上一级路由
  • (..)(..)folder 表示拦截上两级路由
  • (…)folder 表示从根目录拦截

元数据文件约定

App 图标

  • favicon.ico 表示网站图标文件
  • icon.ico .jpg .jpeg .png .svg 表示应用程序图标文件
  • icon.js .ts .tsx 表示生成的应用程序图标文件
  • apple-icon.jpg .jpeg .png 表示苹果应用程序图标文件
  • apple-icon.js .ts .tsx 表示生成的苹果应用程序图标文件

Open Graph 和 Twitter 图像

  • opengraph-image.jpg .jpeg .png .gif 表示 Open Graph 图像文件
  • opengraph-image.js .ts .tsx 表示生成的 Open Graph 图像文件
  • twitter-image.jpg .jpeg .png .gif 表示 Twitter 图像文件
  • twitter-image.js .ts .tsx 表示生成的 Twitter 图像文件

SEO

  • sitemap.xml 表示网站地图文件
  • sitemap.js .ts 表示生成的网站地图文件
  • robots.txt 表示 Robots 文件
  • robots.js .ts 表示生成的 Robots 文件

pages 路由约定

特殊文件

  • _app.js .jsx .tsx 表示自定义 App
  • _document.js .jsx .tsx 表示自定义 Document
  • _error.js .jsx .tsx 表示自定义错误页面
  • 404.js .jsx .tsx 表示404错误页面
  • 500.js .jsx .tsx 表示500错误页面

路由

  • 使用文件夹和文件的命名约定来表示路由

以上是 Next.js 项目结构的概述。

next js之入门安装教程

自动安装

我们建议使用 create-next-app 来开始一个新的 Next.js 应用,它会自动为您设置好一切。要创建一个项目,请运行:

npx create-next-app@latest

安装过程中,您将看到以下提示:

next js之入门教程

项目创建:

安装配置:

我们建议使用 create-next-app创建新的 Next.js 应用程序,它会自动为你设置所有内容。创建项目,请运行:

npx create-next-app@latest
# or
yarn create next-app

如果你希望使用 TypeScript 开发项目,可以通过 --typescript 参数创建 TypeScript 项目:

next js之页面路由

定义路由

我们建议在继续之前阅读路由基础知识页面。

本页面将指导您如何在 Next.js 应用程序中定义和组织路由。

创建路由

Next.js 使用基于文件系统的路由器,其中使用文件夹来定义路由。

30条GPT-4V prompt

30条GPT-4V prompt

内容转自@hridoyreh的推

序号 英文Prompt 中文翻译
1 Logo Design Feedback Logo设计反馈
Analyze the uploaded logo design intended for a solopreneur’s personal brand. Provide feedback on color harmony, visual elements, and overall brand representation. Also, suggest potential improvements to make it more memorable and effective. 分析为个体企业主的个人品牌设计的上传的Logo。提供关于颜色和谐、视觉元素和整体品牌代表性的反馈。同时,建议可能的改进,使其更加难忘和有效。
2 Website Layout Analysis 网站布局分析
Evaluate the visual layout of the solopreneur’s website screenshot provided. Point out design inconsistencies, user experience bottlenecks, and areas for visual enhancement. Provide a guided redesign strategy to improve overall website aesthetics and functionality. 评估提供的个体企业主网站截图的视觉布局。指出设计上的不一致性、用户体验瓶颈和需要视觉增强的区域。提供一个指导性的重新设计策略,以提高整体网站的美观性和功能性。
3 Product Packaging Review 产品包装审查
Inspect the product packaging image submitted. Identify key visual elements, branding consistency, and appeal to the target audience. Offer insights into improving the packaging design for better market reception. 检查提交的产品包装图像。识别关键视觉元素、品牌一致性和对目标受众的吸引力。提供改进包装设计以获得更好市场接受度的见解。
4 Social Media Post Effectiveness 社交媒体帖子效果分析
Analyze the provided solopreneur’s social media post image. Comment on visual engagement, content clarity, and alignment with brand voice. Propose optimization techniques to increase audience engagement and reach. 分析提供的个体企业主的社交媒体帖子图像。评论视觉参与度、内容清晰度和与品牌声音的一致性。提议优化技巧以增加受众参与度和覆盖范围。
5 Print Material Assessment 印刷材料评估
Review the scanned business card and flyer designs. Comment on the choice of typography, color palette, and visual hierarchy. Advise on refining these print materials to ensure they leave a lasting impression. 审查扫描的名片和传单设计。评论字体选择、色彩调色板和视觉层次结构。建议完善这些印刷材料,以确保它们留下深刻的印象。
6 Product Image Enhancement 产品图像增强
Examine the product photos provided. Recommend edits to enhance product visibility, background removal or adjustment, and lighting corrections. Offer tips for more professional product photography in the future. 检查提供的产品照片。推荐编辑以增强产品可见度、背景移除或调整以及光线校正。为未来提供更专业的产品摄影技巧。
7 Merchandise Design Feedback 商品设计反馈
Evaluate the merchandise designs (e.g., T-shirts, mugs) shared. Assess visual appeal, print quality, and brand representation. Propose changes to elevate the merchandise’s market value and attractiveness. 评估共享的商品设计(例如,T恤,马克杯)。评估视觉吸引力、印刷质量和品牌代表性。提议更改以提高商品的市场价值和吸引力。
8 Infographic Analysis 信息图分析
Inspect the solopreneur’s infographic image. Analyze information flow, visual coherence, and design simplicity. Suggest improvements to enhance readability and information retention. 检查个体企业主的信息图像。分析信息流、视觉连贯性和设计简洁性。建议改进以增强可读性和信息保留。
9 Video Thumbnail Effectiveness 视频缩略图效果分析
Review the provided video thumbnail. Comment on visual elements, title readability, and click-through potential. Advise on design tweaks to maximize viewer engagement. 审查提供的视频缩略图。评论视觉元素、标题的可读性和点击潜力。建议设计调整以最大化观众参与度。
10 Event Poster Evaluation 活动海报评估
Analyze the event poster shared. Assess visual hierarchy, call-to-action prominence, and event details clarity. Recommend design alterations to increase event attendance and interest. 分析共享的活动海报。评估视觉层次、行动召唤的突出性和活动细节的清晰度。推荐设计修改以增加活动参与度和兴趣。
11 Workspace Productivity Setup 工作空间生产力设置
Examine the photo of the solopreneur’s workspace. Suggest ergonomic improvements, organization techniques, and aesthetic changes to foster a more productive and motivating work environment. 检查个体企业主的工作空间的照片。建议人体工程学改进、组织技巧和美学变化,以培养更有生产力和激励的工作环境。
12 Product Labeling Review 产品标签审查
Inspect the product label design provided. Comment on legibility, ingredient presentation, and brand consistency. Offer insights into refining the label for better consumer understanding. 检查提供的产品标签设计。评论可读性、成分展示和品牌一致性。提供改进标签以获得更好的消费者理解的见解。
13 Ad Design Analysis 广告设计分析
Evaluate the solopreneur’s advertisement image. Analyze visual appeal, message clarity, and audience targeting. Propose design modifications to optimize conversion rates and brand visibility. 评估个体企业主的广告图像。分析视觉吸引力、信息清晰度和受众定位。提议设计修改以优化转化率和品牌可见度。
14 Photography Portfolio Review 摄影作品集审查
Review the set of photos from the solopreneur’s photography portfolio. Provide feedback on composition, lighting, and post-production. Advise on portfolio arrangement to attract more clientele. 审查来自个体企业主摄影作品集的一组照片。提供关于构图、光线和后期制作的反馈。建议作品集的排列以吸引更多的客户。
15 Instructional Graphic Assessment 教学图形评估
Examine the instructional graphic or tutorial image shared. Comment on step clarity, visual guidance, and overall effectiveness. Recommend enhancements to ensure user understanding and engagement. 检查共享的教学图形或教程图像。评论步骤的清晰度、视觉指导和整体有效性。推荐增强功能以确保用户理解和参与。
16 E-book Cover Evaluation 电子书封面评估
Analyze the e-book cover design provided. Assess title prominence, visual elements, and genre representation. Offer design suggestions to increase e-book downloads and interest. 分析提供的电子书封面设计。评估标题的突出性、视觉元素和类型代表性。提供设计建议以增加电子书下载和兴趣。
17 Blog Imagery Feedback 博客图像反馈
Review the images used in the solopreneur’s blog post. Provide insights into image relevance, quality, and enhancement techniques to ensure better reader engagement and understanding. 审查用于个体企业主博客帖子的图像。提供关于图像相关性、质量和增强技术的见解,以确保更好的读者参与度和理解。
18 Online Course Thumbnail Analysis 在线课程缩略图分析
Evaluate the thumbnail for the solopreneur’s online course. Comment on course topic clarity, visual engagement, and branding. Propose design tweaks to maximize student enrollments. 评估个体企业主在线课程的缩略图。评论课程主题的清晰度、视觉参与度和品牌。提议设计调整以最大化学生注册。
19 Podcast Cover Art Review 播客封面艺术审查
Inspect the podcast cover art image shared. Analyze visual elements, podcast theme representation, and legibility. Recommend changes to boost listener attraction and brand consistency. 检查共享的播客封面艺术图像。分析视觉元素、播客主题代表性和可读性。推荐更改以增强听众吸引力和品牌一致性。
20 Email Header Evaluation 电子邮件标题评估
Examine the email header design provided. Comment on visual appeal, call-to-action visibility, and message clarity. Advise on design adjustments to enhance email open rates and engagement. 检查提供的电子邮件标题设计。评论视觉吸引力、行动召唤的可见性和信息清晰度。建议设计调整以增强电子邮件打开率和参与度。
21 Mobile App UI Feedback 移动应用UI反馈
Review the solopreneur’s mobile app UI screenshots. Provide feedback on user experience, visual design, and functionality. Suggest improvements to elevate user satisfaction and retention. 审查个体企业主的移动应用UI截图。提供关于用户体验、视觉设计和功能的反馈。建议改进以提高用户满意度和保留率。
22 Physical Storefront Analysis 实体店面分析
Analyze the photo of the solopreneur’s physical storefront. Assess branding, window displays, and customer attraction. Offer insights for enhancing in-store traffic and brand recognition. 分析个体企业主的实体店面的照片。评估品牌、橱窗展示和客户吸引力。提供增强店内流量和品牌识别的见解。
23 Artwork Portfolio Review 艺术作品集审查
Evaluate the set of artworks from the solopreneur’s art portfolio. Provide feedback on artistic techniques, theme coherence, and presentation. Advise on portfolio arrangement to garner more appreciation and sales. 评估来自个体企业主艺术作品集的一组艺术品。提供关于艺术技巧、主题连贯性和展示的反馈。建议作品集的排列以获得更多的赞赏和销售。
24 Recipe Presentation Analysis 食谱展示分析
Inspect the photo of the solopreneur’s food dish or recipe presentation. Comment on visual appeal, plating techniques, and clarity. Recommend tweaks to boost recipe popularity and engagement. 检查个体企业主的食物盘或食谱展示的照片。评论视觉吸引力、装盘技巧和清晰度。推荐调整以增强食谱的受欢迎度和参与度。
25 Real Estate Photography Feedback 房地产摄影反馈
Review the real estate photos provided by the solopreneur. Analyze property highlights, lighting, and angles. Suggest improvements for more captivating property listings and quicker sales. 审查个体企业主提供的房地产照片。分析物业亮点、照明和角度。建议改进以获得更吸引人的物业列表和更快的销售。
26 Fashion Lookbook Evaluation 时尚画册评估
Examine the fashion lookbook images shared. Provide insights on outfit presentation, model poses, and brand style. Offer feedback to improve brand visibility and fashion sales. 检查共享的时尚画册图像。提供关于服装展示、模特姿势和品牌风格的见解。提供反馈以提高品牌可见度和时尚销售。
27 Travel Photography Assessment 旅行摄影评估
Inspect the travel photos from the solopreneur’s travel blog. Comment on composition, destination highlights, and post-production. Recommend techniques to attract more blog readership and engagement. 检查来自个体企业主旅行博客的旅行照片。评论构图、目的地亮点和后期制作。推荐技巧以吸引更多的博客读者和参与度。
28 Digital Art Feedback 数字艺术反馈
Evaluate the digital art pieces submitted. Analyze artistic techniques, theme representation, and visual appeal. Provide feedback for refining art skills and market reception. 评估提交的数字艺术作品。分析艺术技巧、主题代表性和视觉吸引力。提供反馈以完善艺术技能和市场接受度。
29 Craftwork Presentation Analysis 手工艺品展示分析
Review the photos of the solopreneur’s craft items. Comment on craftsmanship, presentation, and market appeal. Advise on presentation techniques to boost sales and appreciation. 审查个体企业主的手工艺品的照片。评论工艺、展示和市场吸引力。建议展示技巧以增加销售和赞赏。
30 Workshop or Webinar Poster Feedback 工作坊或网络研讨会海报反馈
Inspect the workshop or webinar poster shared. Assess visual hierarchy, event details clarity, and branding. Offer insights to increase event registrations and brand recognition. 检查共享的工作坊或网络研讨会海报。评估视觉层次、活动细节的清晰度和品牌。提供增加活动注册和品牌识别的见解。

假期戒断

假期戒断

旅行是一场不同生活的全新开始,接触不同的人,经历不同的事情,收获不同的感受。

感受当地不同的人文景观,文化习俗,以及铺面的商业气息店铺。

不同的是,全身心的投入新的旅程中,相当是一次沉浸式的角色扮演,玩过剧本杀的应该都知道。

川西旅行日记

国庆假期流水账:

  1. 09-24:成都集合出发,当天达到康定,红海子,斯丁措,鱼子西,日照金山,入住酒店“天空之境酒店” 新都桥

  2. 09-25:康定出发抵达甘孜,天路十八弯,卡子拉山(4718),稻城县