-
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
translated components-no-ssr & pages-validate #39
base: translation-ru
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
--- | ||
title: "API: The <no-ssr> Component" | ||
description: Skip component rendering on server side(rendering), and display placeholder text. | ||
title: "API: Компонент <no-ssr>" | ||
description: Пропускает создание компонента на стороне сервера | ||
--- | ||
|
||
# The <no-ssr> Component | ||
# Компонент <no-ssr> | ||
|
||
> This component is used to purposely remove the component from the subject of server side rendering. | ||
> Это компонент используется для намеренного удаления из рендеринга на стороне сервера | ||
|
||
**Props**: | ||
- placeholder: `string` | ||
- This prop will be used as a content of inner `div` and displayed as text only on server side rendering. | ||
- То что вы напишите в этом пропсе будет отображаться в момент рендера на стороне сервере вместо обернутого компонента | ||
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. Этот входной параметр будет использован как содержимое |
||
|
||
```html | ||
<template> | ||
|
@@ -22,4 +22,4 @@ description: Skip component rendering on server side(rendering), and display pla | |
</template> | ||
``` | ||
|
||
This component is a clone of [egoist/vue-no-ssr](https://github.com/egoist/vue-no-ssr). Thanks [@egoist](https://github.com/egoist)! | ||
Этот компонент является клоном [egoist/vue-no-ssr](https://github.com/egoist/vue-no-ssr). Выражаем благодарность [@egoist](https://github.com/egoist)! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
--- | ||
title: "API: The validate Method" | ||
description: Nuxt.js lets you define a validator method inside your dynamic route component. | ||
title: "API: Метод validate" | ||
description: Nuxt.js позволяет определить метод валидации в вашем динамическом компоненте | ||
--- | ||
|
||
# The validate Method | ||
# Метод validate | ||
|
||
> Nuxt.js lets you define a validator method inside your dynamic route component. | ||
> Nuxt.js позволяет определить метод валидации в вашем динамическом компоненте | ||
|
||
- **Type:** `Function` | ||
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. Тип можно перевести, а |
||
|
||
```js | ||
validate({ params, query, store }) { | ||
return true // if the params are valid | ||
return false // will stop Nuxt.js to render the route and display the error page | ||
return true // Ничего не произойдет | ||
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. если параметры корректны |
||
return false // Остановит рендер и покажет страницу ошибки 404 | ||
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. если нужно остановить Nuxt.js и вместо рендеринга страницы отобразить страницу ошибки |
||
} | ||
``` | ||
|
||
Nuxt.js lets you define a validator method inside your dynamic route component (In this example: `pages/users/_id.vue`). | ||
Рассмотрим на примере: `pages/users/_id.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. Nuxt.js позволяет вам определить метод для валидации внутри вашего компонента (в этом примере ...) |
||
|
||
If the validate method does not return `true`, Nuxt.js will automatically load the 404 error page. | ||
Если метод не вернет `true`, Nuxt.js автоматически покажет страницу с ошибкой 404 | ||
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. Если метод не вернёт |
||
|
||
```js | ||
export default { | ||
validate ({ params }) { | ||
// Must be a number | ||
// Должно быть цифрой | ||
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. Должен быть числом |
||
return /^\d+$/.test(params.id) | ||
} | ||
} | ||
``` | ||
|
||
You can also check some data in your [store](/guide/vuex-store) for example (filled by [`nuxtServerInit`](/guide/vuex-store#the-nuxtserverinit-action) before action): | ||
Пример того что вы также можете использовать данные из [хранилища состояния](/guide/vuex-store) предварительно заполненное в [`nuxtServerInit`](/guide/vuex-store#the-nuxtserverinit-action)): | ||
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. Вы также можете проверять данные в вашем хранилище (предварительно заполняемое методом ...) может так? |
||
|
||
```js | ||
export default { | ||
validate ({ params, store }) { | ||
// Check if `params.id` is an existing category | ||
// Проверяем что `params.id` является существующей категорией | ||
return store.state.categories.some((category) => category.id === params.id) | ||
} | ||
} | ||
|
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.
Пропускает рендеринг компонента на стороне сервера