Skip to content

Commit

Permalink
Merge pull request #426 from mnenie/translate-fix/components_in_depth
Browse files Browse the repository at this point in the history
translate: some parts in /guide/components
  • Loading branch information
Ibochkarev authored May 5, 2024
2 parents 43130c3 + bc4b4dc commit 7939453
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/guide/components/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,12 @@ defineProps({
type: String,
required: true
},
// Required but nullable string
// Обязательное, но нулевое значение строкового типа
propD: {
type: [String, null],
required: true
},
// Number with a default value
// Число со значением по умолчанию
propE: {
type: Number,
default: 100
Expand Down Expand Up @@ -449,7 +449,7 @@ export default {
type: String,
required: true
},
// Required but nullable string
// Обязательное, но нулевое значение строкового типа
propD: {
type: [String, null],
required: true
Expand Down Expand Up @@ -567,9 +567,9 @@ export default {

Vue будет использовать `instanceof Person` для проверки того, действительно ли значение входного параметра `author` является экземпляром класса `Person`.

### Nullable Type {#nullable-type}
### Обнуляемый Тип {#nullable-type}

If the type is required but nullable, you can use the array syntax that includes `null`:
Если тип является обязательным, но допускает значение null, вы можете использовать синтаксис массива, который включает `null`:

<div class="composition-api">

Expand Down Expand Up @@ -598,7 +598,7 @@ export default {

</div>

Note that if `type` is just `null` without using the array syntax, it will allow any type.
Обратите внимание, что если `type` просто равен `null` без использования синтаксиса массива, то будет разрешен любой тип.

## Булево преобразование {#boolean-casting}

Expand Down
9 changes: 4 additions & 5 deletions src/guide/components/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,13 @@ function BaseLayout(slots) {
}
```

## Conditional Slots {#conditional-slots}
## Условные слоты {#conditional-slots}

Sometimes you want to render something based on whether or not a slot is present.
Иногда вы хотите отрендерить что-то в зависимости от того, присутствует ли слот или нет.

You can use the [$slots](/api/component-instance.html#slots) property in combination with a [v-if](/guide/essentials/conditional.html#v-if) to achieve this.
Вы можете использовать свойство [$slots](/api/component-instance.html#slots) в сочетании с [v-if](/guide/essentials/conditional.html#v-if) для достижения этой цели.

In the example below we define a Card component with three conditional slots: `header`, `footer` and the `default` one.
When the header / footer / default is present we want to wrap them to provide additional styling:
В приведенном ниже примере мы определяем компонент Card с тремя условными слотами: `header`, `footer` и `default`. Когда присутствует header / footer / default, мы хотим обернуть их, чтобы обеспечить дополнительную стилизацию:

```vue-html
<template>
Expand Down
4 changes: 2 additions & 2 deletions src/guide/components/v-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const emit = defineEmits(['update:modelValue'])
</template>
```

Then, `v-model="modelValue"` in the parent component will be compiled to:
Затем `v-model="modelValue"` в родительском компоненте будет скомпилирован в:

```vue-html
<!-- Parent.vue -->
Expand All @@ -83,7 +83,7 @@ Then, `v-model="modelValue"` in the parent component will be compiled to:
/>
```

As you can see, it is quite a bit more verbose. However, it is helpful to understand what is happening under the hood.
Как вы можете видеть, это требует чуть больше кода. Тем не менее, полезно знать, что происходит под капотом.

Поскольку `defineModel` объявляет входные параметры, вы можете также объявить входные параметры основного свойства, передав его в `defineModel`:

Expand Down

1 comment on commit 7939453

@vercel
Copy link

@vercel vercel bot commented on 7939453 May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.