forked from nuxt/docs
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Перевод Routes, Async Data, HTML-head, Static, Directory structure #1
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
75cfdd1
Update basic-routes.md
reg2005 5eea98b
Update basic-routes.md
reg2005 4c1dbbc
Update dynamic-routes.md
reg2005 ded48d1
Update nested-routes.md
reg2005 fc5fbe0
Update basic-routes.md
reg2005 de42388
Update basic-routes.md
reg2005 bdb1fd2
Update dynamic-routes.md
reg2005 f8e7b62
Поправил ошибки
reg2005 0a7d537
Merge branch 'translation-ru' into patch-1
gbezyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
--- | ||
title: Dynamic Routes | ||
description: To define a dynamic route with a param in Nuxt.js, you need to define a Vue file prefixed by an underscore. | ||
title: Динамический роутинг | ||
description: Чтобы объвить динамический путь с параметром (param) в Nuxt.js, вам необходимо создать Vue файл с префиксом: _ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Вам" и прочих личных обращений избегаем — их чаще всего можно просто опустить |
||
--- | ||
|
||
> To define a dynamic route with a param, you need to define a Vue file **prefixed by an underscore**. | ||
> Чтобы определить динамический маршрут с param, Вы должны определить файл Vue **с префиксом нижнее подчеркивание**. | ||
|
||
## Directory Structure | ||
## Структура директорий | ||
|
||
This file tree: | ||
Структура файлов: | ||
|
||
```bash | ||
pages/ | ||
|
@@ -16,7 +16,7 @@ pages/ | |
-----| index.vue | ||
``` | ||
|
||
will automatically generate: | ||
автоматически сгенерирует: | ||
|
||
```js | ||
router: { | ||
|
@@ -35,24 +35,23 @@ router: { | |
} | ||
``` | ||
|
||
## Validate Route Params | ||
## Валидация параметров пути | ||
|
||
```js | ||
validate({ params, query }) { | ||
return true // if the params are valid | ||
return false // will stop Nuxt.js to render the route and display the error page | ||
return true // если этот параметр валиден | ||
return false // остановит Nuxt.js, чтобы отобразить маршрут и вывести на экран страницу ошибки | ||
} | ||
``` | ||
|
||
Nuxt.js lets you define a validator method inside your dynamic route component (In this example: `pages/users/_id.vue`). | ||
|
||
If the validate method does not return `true`, Nuxt.js will automatically load the 404 error page. | ||
Nuxt.js позволяет Вам определять метод проверки валидности в своем динамическом компоненте пути (В этом примере: `pages/users/_id.vue`). | ||
Если метод валидации не возвратит `true`, Nuxt.js автоматически отобразит страницу с ошибкой 404. | ||
|
||
```js | ||
<script> | ||
export default { | ||
validate ({ params }) { | ||
// Must be a number | ||
// Должен быть номером | ||
return /^\d+$/.test(params.id) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Структура файлов всё-таки ;)