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
Copy file name to clipboardExpand all lines: src/v2/guide/render-function.md
+34-35Lines changed: 34 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -123,36 +123,36 @@ Dalam kedua kasus, Vue secara otomatis akan memastikan bahwa tampilannya diperba
123
123
124
124
### The Virtual DOM
125
125
126
-
Vue accomplishes this by building a **virtual DOM**to keep track of the changes it needs to make to the real DOM. Taking a closer look at this line:
126
+
Vue melakukannya dengan cara membuat **virtual DOM**untuk mencatat perubahan yang dibutuhkan untuk merekonstruksi DOM yang sebenarnya. Lihat baris kode di bawah :
127
127
128
128
```js
129
129
returncreateElement('h1', this.blogTitle)
130
130
```
131
131
132
-
What is `createElement`actually returning? It's not _exactly_ a real DOM element. It could perhaps more accurately be named `createNodeDescription`, as it contains information describing to Vue what kind of node it should render on the page, including descriptions of any child nodes. We call this node description a "virtual node", usually abbreviated to **VNode**. "Virtual DOM" is what we call the entire tree of VNodes, built by a tree of Vue components.
132
+
Apa yang sebenarnya `createElement`kembalikan? hal itu bukanlah elemen DOM yang benar-benar diproses oleh browser. Secara teknis, lebih akurat jika dinamakan `createNodeDescription`, karena berisi informasi yang dibutuhkan oleh Vue, jenis node apa yang harus ditampilkan; termasuk deskripsi ini dari node tersebut. Deskripsi node ini diistilahkan dengan "virtual node", biasanya disingkat **VNode**. Sedangkan "Virtual DOM" digunakan untuk merujuk ke kumpulan dari VNode secara keseluruhan.
133
133
134
-
## `createElement` Arguments
134
+
## Argumen `createElement`
135
135
136
-
The next thing you'll have to become familiar with is how to use template features in the `createElement` function. Here are the arguments that`createElement` accepts:
136
+
Untuk lebih mendalami bagaimana cara penggunaan fitur templat di fungsi `createElement`, berikut beberapa argumen yang diterima oleh`createElement`:
137
137
138
138
```js
139
139
// @returns {VNode}
140
140
createElement(
141
141
// {String | Object | Function}
142
-
//An HTML tag name, component options, or async
143
-
//function resolving to one of these. Required.
142
+
//Nama tag HTML, opsi komponen, atau fungsi asinkronus
143
+
//Fungsi resolving ke salah satu. Wajib.
144
144
'div',
145
145
146
146
// {Object}
147
-
//A data object corresponding to the attributes
148
-
//you would use in a template. Optional.
147
+
//Objek data yang terkait dengan atribut
148
+
//Anda akan gunakan dalam templat. Opsional.
149
149
{
150
-
// (see details in the next section below)
150
+
// (lihat detail di bagian selanjutnya)
151
151
},
152
152
153
153
// {String | Array}
154
-
//Children VNodes, built using `createElement()`,
155
-
//or using strings to get 'text VNodes'. Optional.
154
+
//Isi VNode, bisa dengan `createElement()`,
155
+
//atau string sepert 'text VNodes'. Opsional.
156
156
[
157
157
'Some text comes first.',
158
158
createElement('h1', 'A headline'),
@@ -167,50 +167,49 @@ createElement(
167
167
168
168
### The Data Object In-Depth
169
169
170
-
One thing to note: similar to how `v-bind:class`and`v-bind:style`have special treatment in templates, they have their own top-level fields in VNode data objects. This object also allows you to bind normal HTML attributes as well as DOM properties such as `innerHTML` (this would replace the `v-html` directive):
170
+
Penting untuk dicatat, sama halnya `v-bind:class`dan`v-bind:style`diperlakukan secara khusus di templat, mereka punya tempat tersendiri juga di objek data dari VNode. Lewat objek ini kalian juga melakukan proses *binding* ke atribut bawaan HTML juga properti DOM seperti `innerHTML` (menggantikan direktif `v-html`):
171
171
172
172
```js
173
173
{
174
-
//Same API as `v-bind:class`, accepting either
175
-
//a string, object, or array of strings and objects.
174
+
//Sama seperti `v-bind:class`, bisa diisi dengan
175
+
// string, objek, atau array dari string dan objek
176
176
class: {
177
177
foo:true,
178
178
bar:false
179
179
},
180
-
//Same API as `v-bind:style`, accepting either
181
-
//a string, object, or array of objects.
180
+
//Sama seperti `v-bind:style`, bisa diisi dengan
181
+
// string, objek, atau array dari objek
182
182
style: {
183
183
color:'red',
184
184
fontSize:'14px'
185
185
},
186
-
//Normal HTML attributes
186
+
//Atribut bawaan HTML
187
187
attrs: {
188
188
id:'foo'
189
189
},
190
-
//Component props
190
+
//properti komponen
191
191
props: {
192
192
myProp:'bar'
193
193
},
194
-
//DOM properties
194
+
//properti DOM
195
195
domProps: {
196
196
innerHTML:'baz'
197
197
},
198
-
// Event handlers are nested under `on`, though
199
-
//modifiers such as in `v-on:keyup.enter` are not
200
-
//supported. You'll have to manually check the
201
-
//keyCode in the handler instead.
198
+
// Event handler diletakkan di dalam `on`, meskipun
199
+
//modifier sepeti `v-on:keyup.enter` tidak
200
+
//didukung. Anda harus melakukan pemeriksaan manual
201
+
//untuk keyCodenya.
202
202
on: {
203
203
click:this.clickHandler
204
204
},
205
-
//For components only. Allows you to listen to
206
-
//native events, rather than events emitted from
207
-
//the component using `vm.$emit`.
205
+
//Hanya untuk komponen, digunakan untuk memperhatikan
206
+
//event bawaan, selain dari event yang dihasilkan oleh
207
+
//komponen yang menggunakan `vm.$emit`.
208
208
nativeOn: {
209
209
click:this.nativeClickHandler
210
210
},
211
-
// Custom directives. Note that the `binding`'s
212
-
// `oldValue` cannot be set, as Vue keeps track
213
-
// of it for you.
211
+
// Direktif kustom. Ingat bahwa `oldValue` tidak bisa diisi secara manual
212
+
// Karena Vue akan mengaturnya sendiri.
214
213
directives: [
215
214
{
216
215
name:'my-custom-directive',
@@ -222,19 +221,19 @@ One thing to note: similar to how `v-bind:class` and `v-bind:style` have special
222
221
}
223
222
}
224
223
],
225
-
// Scoped slots in the form of
224
+
// Scoped slots dalam bentuk
226
225
// { name: props => VNode | Array<VNode> }
227
226
scopedSlots: {
228
227
default:props=>createElement('span', props.text)
229
228
},
230
-
//The name of the slot, if this component is the
231
-
//child of another component
229
+
//Nama dari slot, jika komponen ini
230
+
//anak dari komponen lain
232
231
slot:'name-of-slot',
233
-
//Other special top-level properties
232
+
//Properti khusus lainnya
234
233
key:'myKey',
235
234
ref:'myRef',
236
-
//If you are applying the same ref name to multiple
237
-
//elements in the render function. This will make `$refs.myRef` become an
235
+
//Jika kalian menggunakan nama ref yang sama
236
+
//di beberapa tempat, nilai dari `$refs.myRef` akan berbentuk
0 commit comments