You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to pass all the properties of an object as props, you can use`v-bind`without an argument (`v-bind`instead of `v-bind:prop-name`). For example, given a `post` object:
130
+
Якщо ви хотіли б передати всі властивості об'єкту, як вхідні параметри, ви можете скористатися`v-bind`без аргументу (`v-bind`замість `v-bind:prop-name`). Для прикладу, в нас є об'єкт `post`:
131
131
132
132
```js
133
133
post: {
134
134
id:1,
135
-
title:'My Journey with Vue'
135
+
title:'Мій шлях з Vue'
136
136
}
137
137
```
138
138
139
-
The following template:
139
+
Наступний шаблон:
140
140
141
141
```html
142
142
<blog-postv-bind="post"></blog-post>
143
143
```
144
144
145
-
Will be equivalent to:
145
+
Еквівалентний наступному:
146
146
147
147
```html
148
148
<blog-post
@@ -151,13 +151,13 @@ Will be equivalent to:
151
151
></blog-post>
152
152
```
153
153
154
-
## One-Way Data Flow
154
+
## Односторонній перебіг даних
155
155
156
-
All props form a**one-way-down binding**between the child property and the parent one: when the parent property updates, it will flow down to the child, but not the other way around. This prevents child components from accidentally mutating the parent's state, which can make your app's data flow harder to understand.
156
+
Всі вхідні параметри формують**односторонній зв'язок**між дочірніми властивостями та батьківським: коли батьківська властивість змінюється, це перейде вниз аж до дочірніх, але не навпаки. Це запобігає дочірні компоненти випадково мутувати стан батьківських, щоб могло б зробити перебіг даних вашого застосунку складнішим для розуміння.
157
157
158
-
In addition, every time the parent component is updated, all props in the child component will be refreshed with the latest value. This means you should**not**attempt to mutate a prop inside a child component. If you do, Vue will warn you in the console.
158
+
Крім того, щоразу, коли батьківський компонент оновлено, всі вхідні параметри дочірнього компоненту будуть оновлені автоматично новими значеннями. Це означає, що ви**не**повинні намагатися мутувати вхідний параметр усередині дочірньої компоненти. Якщо ж ви спробуєте це зробити, Vue попередить вас в консолі розробника.
159
159
160
-
There are usually two cases where it's tempting to mutate a prop:
160
+
Як правило, існує два випадки, де хочеться змінити вхідний параметр:
161
161
162
162
1.**The prop is used to pass in an initial value; the child component wants to use it as a local data property afterwards.** In this case, it's best to define a local data property that uses the prop as its initial value:
0 commit comments