Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
13f05f2c
Commit
13f05f2c
authored
Oct 09, 2019
by
manfwh
Committed by
Tim Neutkens
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README-zh-CN.md static-file-serving-eg-images (#9002)
parent
32633c83
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
README-zh-CN.md
README-zh-CN.md
+4
-4
No files found.
README-zh-CN.md
View file @
13f05f2c
...
@@ -133,7 +133,7 @@ export default () => <div>Welcome to next.js!</div>
...
@@ -133,7 +133,7 @@ export default () => <div>Welcome to next.js!</div>
-
自动打包编译 (使用 webpack 和 babel)
-
自动打包编译 (使用 webpack 和 babel)
-
热加载
-
热加载
-
以
`./pages`
作为服务的渲染和索引
-
以
`./pages`
作为服务的渲染和索引
-
静态文件服务.
`./
static/`
映射到
`/static
/`
(可以
[
创建一个静态目录
](
#static-file-serving-eg-images
)
在你的项目中)
-
静态文件服务.
`./
public/`
映射到
`
/`
(可以
[
创建一个静态目录
](
#static-file-serving-eg-images
)
在你的项目中)
这里有个简单的案例,可以下载看看
[
sample app - nextgram
](
https://github.com/zeit/nextgram
)
这里有个简单的案例,可以下载看看
[
sample app - nextgram
](
https://github.com/zeit/nextgram
)
...
@@ -227,13 +227,13 @@ export default () => <p style={{ color: 'red' }}>hi there</p>
...
@@ -227,13 +227,13 @@ export default () => <p style={{ color: 'red' }}>hi there</p>
### 静态文件服务(如图像)
### 静态文件服务(如图像)
在根目录下新建文件夹叫
`
static`
。代码可以通过
`/static
/`
来引入相关的静态资源。
在根目录下新建文件夹叫
`
public`
。代码可以通过
`
/`
来引入相关的静态资源。
```
jsx
```
jsx
export
default
()
=>
<
img
src=
"/
static/
my-image.png"
alt=
"my image"
/>
export
default
()
=>
<
img
src=
"/my-image.png"
alt=
"my image"
/>
```
```
_注意:不要自定义静态文件夹的名字,只能叫`
stat
ic` ,因为只有这个名字 Next.js 才会把它当作静态资源。_
_注意:不要自定义静态文件夹的名字,只能叫`
publ
ic` ,因为只有这个名字 Next.js 才会把它当作静态资源。_
<a
id=
"populating-head"
style=
"display: none"
></a>
<a
id=
"populating-head"
style=
"display: none"
></a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment