Skip to content

Commit 69d2ad0

Browse files
ikrydevmazipan
authored andcommitted
Fungsi Render Selesai (#185)
1 parent 3925f0b commit 69d2ad0

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/v2/guide/render-function.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ Penting untuk dicatat, sama halnya `v-bind:class` dan `v-bind:style` diperlakuka
239239
}
240240
```
241241

242-
### Complete Example
242+
### Contoh Lengkap
243243

244-
With this knowledge, we can now finish the component we started:
244+
Dengan informasi di atas, kita bisa melanjutkan komponen yang tadi kita buat:
245245

246246
``` js
247247
var getChildrenTextContent = function (children) {
@@ -254,7 +254,7 @@ var getChildrenTextContent = function (children) {
254254

255255
Vue.component('anchored-heading', {
256256
render: function (createElement) {
257-
// create kebab-case id
257+
// membuat id kebab-case
258258
var headingId = getChildrenTextContent(this.$slots.default)
259259
.toLowerCase()
260260
.replace(/\W+/g, '-')
@@ -281,11 +281,11 @@ Vue.component('anchored-heading', {
281281
})
282282
```
283283

284-
### Constraints
284+
### Keterbatasan
285285

286-
#### VNodes Must Be Unique
286+
#### VNode harus unik
287287

288-
All VNodes in the component tree must be unique. That means the following render function is invalid:
288+
Semua VNode yang ada di silsilah pohon komponen harus unik. Artinya, contoh di bawah salah:
289289

290290
``` js
291291
render: function (createElement) {
@@ -297,7 +297,7 @@ render: function (createElement) {
297297
}
298298
```
299299

300-
If you really want to duplicate the same element/component many times, you can do so with a factory function. For example, the following render function is a perfectly valid way of rendering 20 identical paragraphs:
300+
Jika kalian memang ingin menduplikasi elemen/komponen yang sama beberapa kali, kalian bisa menggunakan fungsi *factory*. Di bawah ini adalah contoh yang valid untuk menampilkan 20 paragraf yang sama:
301301

302302
``` js
303303
render: function (createElement) {
@@ -309,11 +309,11 @@ render: function (createElement) {
309309
}
310310
```
311311

312-
## Replacing Template Features with Plain JavaScript
312+
## Mengganti Fitur Templat Dengan JavaScript
313313

314-
### `v-if` and `v-for`
314+
### `v-if` dan `v-for`
315315

316-
Wherever something can be easily accomplished in plain JavaScript, Vue render functions do not provide a proprietary alternative. For example, in a template using `v-if` and `v-for`:
316+
Jika ada hal sederhana yang bisa dicapai dengan mudah menggunakan JavaScript, fungsi render Vue tidak menyediakan cara khusus untuk melakukannya. Contohnya, penggunaan `v-if` dan `v-for` di templat:
317317

318318
``` html
319319
<ul v-if="items.length">
@@ -322,7 +322,7 @@ Wherever something can be easily accomplished in plain JavaScript, Vue render fu
322322
<p v-else>No items found.</p>
323323
```
324324

325-
This could be rewritten with JavaScript's `if`/`else` and `map` in a render function:
325+
Bisa ditulis dengan `if`/`else` dan `map` bawaan dari JavaScript:
326326

327327
``` js
328328
props: ['items'],
@@ -339,7 +339,7 @@ render: function (createElement) {
339339

340340
### `v-model`
341341

342-
There is no direct `v-model` counterpart in render functions - you will have to implement the logic yourself:
342+
Tidak ada fitur yang mirip `v-model` di fungsi render, kalian harus menerapkannya sendiri:
343343

344344
``` js
345345
props: ['value'],
@@ -358,11 +358,11 @@ render: function (createElement) {
358358
}
359359
```
360360

361-
This is the cost of going lower-level, but it also gives you much more control over the interaction details compared to `v-model`.
361+
Mungkin terasa lebih susah, tapi kalian punya kendali penuh dibandingkan `v-model`.
362362

363-
### Event & Key Modifiers
363+
### *Event* & *Key Modifiers*
364364

365-
For the `.passive`, `.capture` and `.once` event modifiers, Vue offers prefixes that can be used with `on`:
365+
Untuk modifier event seperti `.passive`, `.capture`, dan `.once`; Vue memberikan prefix yang bisa digunakan dengan `on`:
366366

367367
| Modifier(s) | Prefix |
368368
| ------ | ------ |
@@ -371,7 +371,7 @@ For the `.passive`, `.capture` and `.once` event modifiers, Vue offers prefixes
371371
| `.once` | `~` |
372372
| `.capture.once` or<br>`.once.capture` | `~!` |
373373

374-
For example:
374+
Contoh:
375375

376376
```javascript
377377
on: {
@@ -381,7 +381,7 @@ on: {
381381
}
382382
```
383383

384-
For all other event and key modifiers, no proprietary prefix is necessary, because you can use event methods in the handler:
384+
Untuk event dan key modifier lainnya, tidak ada prefix yang dibutuhkan, cukup gunakan event method-nya di handler:
385385

386386
| Modifier(s) | Equivalent in Handler |
387387
| ------ | ------ |
@@ -391,30 +391,30 @@ For all other event and key modifiers, no proprietary prefix is necessary, becau
391391
| Keys:<br>`.enter`, `.13` | `if (event.keyCode !== 13) return` (change `13` to [another key code](http://keycode.info/) for other key modifiers) |
392392
| Modifiers Keys:<br>`.ctrl`, `.alt`, `.shift`, `.meta` | `if (!event.ctrlKey) return` (change `ctrlKey` to `altKey`, `shiftKey`, or `metaKey`, respectively) |
393393

394-
Here's an example with all of these modifiers used together:
394+
Berikut contoh untuk penggunaan modifier di atas:
395395

396396
```javascript
397397
on: {
398398
keyup: function (event) {
399-
// Abort if the element emitting the event is not
400-
// the element the event is bound to
399+
// Batalkan jika elemen yang menghasilkan event ini bukan
400+
// elemen tempat event-nya di pasang
401401
if (event.target !== event.currentTarget) return
402-
// Abort if the key that went up is not the enter
403-
// key (13) and the shift key was not held down
404-
// at the same time
402+
// Batalkan jika key yang ditekan bukanlah tombol enter,
403+
// dan tombol shift tidak ditekan
404+
// di waktu yang sama
405405
if (!event.shiftKey || event.keyCode !== 13) return
406-
// Stop event propagation
406+
// Hentikan propagasi event
407407
event.stopPropagation()
408-
// Prevent the default keyup handler for this element
408+
// Hentikan event handler dasar untuk event ini
409409
event.preventDefault()
410410
// ...
411411
}
412412
}
413413
```
414414

415-
### Slots
415+
### Slot
416416

417-
You can access static slot contents as Arrays of VNodes from [`this.$slots`](../api/#vm-slots):
417+
Kalian bisa mengakses isi slot statik sebagai array VNode dari [`this.$slots`](../api/#vm-slots):
418418

419419
``` js
420420
render: function (createElement) {
@@ -423,7 +423,7 @@ render: function (createElement) {
423423
}
424424
```
425425

426-
And access scoped slots as functions that return VNodes from [`this.$scopedSlots`](../api/#vm-scopedSlots):
426+
Dan mengakses slot berlingkup (scoped) sebagai fungsi yang mengembalikan VNode dari [`this.$scopedSlots`](../api/#vm-scopedSlots):
427427

428428
``` js
429429
props: ['message'],
@@ -437,14 +437,14 @@ render: function (createElement) {
437437
}
438438
```
439439

440-
To pass scoped slots to a child component using render functions, use the `scopedSlots` field in VNode data:
440+
Untuk meneruskan slot berlingkup ke komponen di dalamnya melalui fungsi render, gunakan field `scopedSlots` di data VNode:
441441

442442
``` js
443443
render: function (createElement) {
444444
return createElement('div', [
445445
createElement('child', {
446-
// pass `scopedSlots` in the data object
447-
// in the form of { name: props => VNode | Array<VNode> }
446+
// teruskan `scopedSlots` di objek data
447+
// dalam bentuk { name: props => VNode | Array<VNode> }
448448
scopedSlots: {
449449
default: function (props) {
450450
return createElement('span', props.text)

0 commit comments

Comments
 (0)