Skip to content
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

translate: some parts in /guide/components #426

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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