diff --git a/src/guide/components/props.md b/src/guide/components/props.md index 7794434c..0658b958 100644 --- a/src/guide/components/props.md +++ b/src/guide/components/props.md @@ -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 @@ -449,7 +449,7 @@ export default { type: String, required: true }, - // Required but nullable string + // Обязательное, но нулевое значение строкового типа propD: { type: [String, null], required: true @@ -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`:
@@ -598,7 +598,7 @@ export default {
-Note that if `type` is just `null` without using the array syntax, it will allow any type. +Обратите внимание, что если `type` просто равен `null` без использования синтаксиса массива, то будет разрешен любой тип. ## Булево преобразование {#boolean-casting} diff --git a/src/guide/components/slots.md b/src/guide/components/slots.md index d1be9ce8..c72e48ad 100644 --- a/src/guide/components/slots.md +++ b/src/guide/components/slots.md @@ -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 ``` -Then, `v-model="modelValue"` in the parent component will be compiled to: +Затем `v-model="modelValue"` в родительском компоненте будет скомпилирован в: ```vue-html @@ -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`: