Skip to content

Commit fe34aca

Browse files
authored
Merge pull request vuejs#124 from angloo/mirza_built_in_directive
Halaman Built In Directive
2 parents 25d13bc + e0ad082 commit fe34aca

File tree

1 file changed

+62
-63
lines changed

1 file changed

+62
-63
lines changed

src/v2/guide/migration.md

Lines changed: 62 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
title: Migrasi dari Vue 1.x
32
type: guide
43
order: 701
@@ -384,49 +383,51 @@ methods: {
384383
</div>
385384
{% endraw %}
386385

387-
## Built-In Directives
386+
## Direktif Bawaan
387+
388+
### _Truthiness/Falsiness_ dengan `v-bind` <sup>diubah</sup>
388389

389-
### Truthiness/Falsiness with `v-bind` <sup>changed</sup>
390+
Ketika digunakan dengan `v-bind`, nilai yang bernilai _false_ sekarang hanya: `null`, `undefined`, dan `false`. ini berarti `0` dan _string_ kosong akan bernilai _true_. Contohnya, `v-bind:draggable="''"` diperbaiki menjadi `draggable="true"`.
390391

391-
When used with `v-bind`, the only falsy values are now: `null`, `undefined`, and `false`. This means `0` and empty strings will render as truthy. So for example, `v-bind:draggable="''"` will render as `draggable="true"`.
392392

393-
For enumerated attributes, in addition to the falsy values above, the string `"false"` will also render as `attr="false"`.
393+
Untuk atribut yang disebutkan, selain nilai-nilai palsu diatas, nilai _string_ `"false"` akan di-_render_ sebagai `attr="false"`.
394394

395-
<p class="tip">Note that for other directives (e.g. `v-if` and `v-show`), JavaScript's normal truthiness still applies.</p>
395+
<p class="tip">Catatan untuk direktif lainnya (e.g. `v-if` and `v-show`), nilai-nilai *truthiness* JavaScript masih berlaku.</p>
396396

397397
{% raw %}
398398
<div class="upgrade-path">
399-
<h4>Upgrade Path</h4>
400-
<p>Run your end-to-end test suite, if you have one. The <strong>failed tests</strong> should alert to you to any parts of your app that may be affected by this change.</p>
399+
<h4>Jalur Upgrade</h4>
400+
<p> Jalankan *end-to-end test suite* Anda, Jika Anda memilikinya. Bagian <strong>*failed tests*</strong> akan memperingatkan Anda terhadap bagian-bagian dari aplikasi yang terkena dampak oleh perubahan ini.</p>
401401
</div>
402402
{% endraw %}
403403

404-
### Listening for Native Events on Components with `v-on` <sup>changed</sup>
404+
### Mengetahui nilai asli dengan `v-on` <sup>diubah/sup>
405+
406+
Ketika digunakan pada sebuah komponen, `v-on` hanya akan mendengarkan _event-event_ yang ter- `$emit` oleh komponen tersebut. Untuk mendengarkan _event DOM_ bawaan pada elemen root, Anda dapat menggunakan *modifier* `.native`. Contohnya:
405407

406-
When used on a component, `v-on` now only listens to custom events `$emit`ted by that component. To listen for a native DOM event on the root element, you can use the `.native` modifier. For example:
407408

408409
{% codeblock lang:html %}
409410
<my-component v-on:click.native="doSomething"></my-component>
410411
{% endcodeblock %}
411412

412413
{% raw %}
413414
<div class="upgrade-path">
414-
<h4>Upgrade Path</h4>
415-
<p>Run your end-to-end test suite, if you have one. The <strong>failed tests</strong> should alert to you to any parts of your app that may be affected by this change.</p>
415+
<h4>Jalur Upgrade</h4>
416+
<p>Jalankan <i>end-to-end</i>, jika Anda memilikinya. Bagian <strong>*failed tests*</strong> akan memperingatkan Anda terhadap bagian-bagian dari aplikasi yang terkena dampak oleh perubahan ini.</p>
416417
</div>
417418
{% endraw %}
418419

419-
### `debounce` Param Attribute for `v-model` <sup>removed</sup>
420+
### `debounce` Atribut Param untuk `v-model` <sup>dihapus</sup>
420421

421-
Debouncing is used to limit how often we execute Ajax requests and other expensive operations. Vue's `debounce` attribute parameter for `v-model` made this easy for very simple cases, but it actually debounced __state updates__ rather than the expensive operations themselves. It's a subtle difference, but it comes with limitations as an application grows.
422+
Vue's `debounce` parameter atribut untuk `v-model` membuat mudah untuk kasus - kasus sederhana, tetapi operasi ini sebenarnya ditolak oleh *__state updates__* daripada operasi yang mahal itu sendiri. Ini sebuah perbedaan yang halus, namun akan ada keterbatasan jika aplikasi tersebut tumbuh.
422423

423-
These limitations become apparent when designing a search indicator, like this one for example:
424+
Keterbatasan itu akan muncul ketika merancang indikator pencarian, Seperti:
424425

425426
{% raw %}
426427
<script src="https://cdn.jsdelivr.net/lodash/4.13.1/lodash.js"></script>
427428
<div id="debounce-search-demo" class="demo">
428-
<input v-model="searchQuery" placeholder="Type something">
429-
<strong>{{ searchIndicator }}</strong>
429+
<input v-model="searchQuery" placeholder="Tulis Sesuatu">
430+
<strong>{{ Pencarian indikator }}</strong>
430431
</div>
431432
<script>
432433
new Vue({
@@ -466,14 +467,12 @@ new Vue({
466467
</script>
467468
{% endraw %}
468469

469-
Using the `debounce` attribute, there'd be no way to detect the "Typing" state, because we lose access to the input's real-time state. By decoupling the debounce function from Vue however, we're able to debounce only the operation we want to limit, removing the limits on features we can develop:
470+
Menggunakan atribut `debounce`, tidak ada cara untuk mengenali "Tipe" *state*, karena kita kehilangan akses pada *input real-time state*. Namun memisahkan fungsi *debounce* dari Vue, kami hanya dapat *debounce* pada operasi yang kami ingin batasi, menghapus keterbatasan pada fitur dapat dikembangkan sebagai berikut:
471+
470472

471473
``` html
472474
<!--
473-
By using the debounce function from lodash or another dedicated
474-
utility library, we know the specific debounce implementation we
475-
use will be best-in-class - and we can use it ANYWHERE. Not only
476-
in our template.
475+
Dengan menggunakan fungsi debounce dari lodash atau perpustakaan utilitas khusus lainnya, kami tahu implementasi debounce spesifik yang kami gunakan akan menjadi yang terbaik di kelasnya - dan kita dapat menggunakannya dimana saja. Tidak hanya di template kami.
477476
-->
478477
<script src="https://cdn.jsdelivr.net/lodash/4.13.1/lodash.js"></script>
479478
<div id="debounce-search-demo">
@@ -520,25 +519,25 @@ new Vue({
520519
})
521520
```
522521

523-
Another advantage of this approach is there will be times when debouncing isn't quite the right wrapper function. For example, when hitting an API for search suggestions, waiting to offer suggestions until after the user has stopped typing for a period of time isn't an ideal experience. What you probably want instead is a __throttling__ function. Now since you're already using a utility library like lodash, refactoring to use its `throttle` function instead takes only a few seconds.
522+
Keuntungan lain dari pendekatan ini adalah akan ada waktu ketika *debouncing* tidak cukup sebagai fungsi *wrapper*. Misalnya, saat memanggil API untuk pencarian saran, menunggu untuk menawarkan saran sampai setelah pengguna berhenti mengetik untuk jangka waktu tertentu bukanlah pengalaman yang ideal. Yang mungkin Anda inginkan adalah fungsi __throttling__. Sekarang karena Anda sudah menggunakan pustaka utilitas seperti lodash, refactoring untuk menggunakan fungsi `throttle` sebagai gantinya hanya membutuhkan beberapa detik.
524523

525524
{% raw %}
526525
<div class="upgrade-path">
527-
<h4>Upgrade Path</h4>
528-
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of the <code>debounce</code> attribute.</p>
526+
<h4>Jalur Upgrade</h4>
527+
<p>Jalankan <a href="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> dari <i>codebase</i> Anda untuk mencari contoh-contoh atribut <code>*debounce*</code>.</p>
529528
</div>
530529
{% endraw %}
531530

532-
### `lazy` or `number` Param Attributes for `v-model` <sup>replaced</sup>
531+
### `lazy` atau `number` Atribut Param untuk `v-model` <sup>diganti</sup>
533532

534-
The `lazy` and `number` param attributes are now modifiers, to make it more clear what That means instead of:
533+
`lazy` dan `number` param atribut dapat di modifikasi, untuk membuat lebih jelas, artinya:
535534

536535
``` html
537536
<input v-model="name" lazy>
538537
<input v-model="age" type="number" number>
539538
```
540539

541-
You would use:
540+
Kamu dapat menggunakan:
542541

543542
``` html
544543
<input v-model.lazy="name">
@@ -547,135 +546,135 @@ You would use:
547546

548547
{% raw %}
549548
<div class="upgrade-path">
550-
<h4>Upgrade Path</h4>
551-
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of the these param attributes.</p>
549+
<h4>Jalur Upgrade</h4>
550+
<p>Jalankan <a href="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> dari <i>codebase</i> Anda untuk mencari contoh-contoh atribut .</p>
552551
</div>
553552
{% endraw %}
554553

555-
### `value` Attribute with `v-model` <sup>removed</sup>
554+
### `value` Atribut dengan `v-model` <sup>dihapus</sup>
556555

557-
`v-model` no longer cares about the initial value of an inline `value` attribute. For predictability, it will instead always treat the Vue instance data as the source of truth.
556+
`v-model` tidak peduli dengan nilai awal dari barisan atribut `value`. Untuk bisa diprediksi, `v-model` akan memperlakukan data dari Vue *intance* sebagai sumber kebenaran.
558557

559-
That means this element:
558+
Maksud dari elemen ini:
560559

561560
``` html
562561
<input v-model="text" value="foo">
563562
```
564563

565-
backed by this data:
564+
Didukung dengan data ini:
566565

567566
``` js
568567
data: {
569568
text: 'bar'
570569
}
571570
```
572571

573-
will render with a value of "bar" instead of "foo". The same goes for a `<textarea>` with existing content. Instead of:
572+
Akan *render* dengan nilai "bar" daripada "foo". Hal yang sama berlaku untuk `<textarea>` dengan konten yang ada. Daripada:
574573

575574
``` html
576575
<textarea v-model="text">
577576
hello world
578577
</textarea>
579578
```
580579

581-
You should ensure your initial value for `text` is "hello world".
580+
Anda harus memastikan nilai awal `text` adalah "hello world".
582581

583582
{% raw %}
584583
<div class="upgrade-path">
585-
<h4>Upgrade Path</h4>
586-
<p>Run your end-to-end test suite or app after upgrading and look for <strong>console warnings</strong> about inline value attributes with <code>v-model</code>.</p>
584+
<h4>Jalur Upgrade</h4>
585+
<p>Jalankan *end-to-end test suite* atau peningkatan setelah pengujian aplikasi dan mencari <strong><i>console warnings<i></strong> tentang kebenaran nilai dalam atribut <code>v-model</code>.</p>
587586
</div>
588587
{% endraw %}
589588

590-
### `v-model` with `v-for` Iterated Primitive Values <sup>removed</sup>
589+
### `v-model` dengan `v-for` Nilai Primtif Iterasi<sup>dihapus</sup>
591590

592-
Cases like this no longer work:
591+
Kasus seperti ini tidak berfungsi lagi pada:
593592

594593
``` html
595594
<input v-for="str in strings" v-model="str">
596595
```
597596

598-
The reason is this is the equivalent JavaScript that the `<input>` would compile to:
597+
Alasannya adalah kesetaraan Javascript yang akan di *compile</i> dari `<input>` tersebut:
599598

600599
``` js
601600
strings.map(function (str) {
602601
return createElement('input', ...)
603602
})
604603
```
605604

606-
As you can see, `v-model`'s two-way binding doesn't make sense here. Setting `str` to another value in the iterator function will do nothing because it's only a local variable in the function scope.
605+
Seperti yang Anda lihat, `v-model` pengikatan dua arah ini tidak masuk akal . Menetapkan `str` menjadi nilai lain dalam fungsi iterasi tetapi tidak akan melakukan apa-apa karena itu hanya variabel lokal yang berada dalam cakupan fungsi.
607606

608-
Instead, you should use an array of __objects__ so that `v-model` can update the field on the object. For example:
607+
Sebagai gantinya, Anda seharusnya menggunakan *array __objects__* sehingga `v-model` bisa memperbaharui *field* dalam *object* tersebut. Seperti:
609608

610609
{% codeblock lang:html %}
611610
<input v-for="obj in objects" v-model="obj.str">
612611
{% endcodeblock %}
613612

614613
{% raw %}
615614
<div class="upgrade-path">
616-
<h4>Upgrade Path</h4>
617-
<p>Run your test suite, if you have one. The <strong>failed tests</strong> should alert to you to any parts of your app that may be affected by this change.</p>
615+
<h4>Jalur Upgrade></h4>
616+
<p>Jalankan *your test suite*, jika Anda memilikinya. Bagian <strong>*failed tests*</strong> akan memperingatkan Anda terhadap bagian-bagian dari aplikasi yang terkena dampak oleh perubahan ini.</p>
618617
</div>
619618
{% endraw %}
620619

621-
### `v-bind:style` with Object Syntax and `!important` <sup>removed</sup>
620+
### `v-bind:style` dengan *Object Syntax* dan `!important` <sup>dihapus</sup>
622621

623-
This will no longer work:
622+
Konsep ini tidak lagi berfungsi:
624623

625624
``` html
626625
<p v-bind:style="{ color: myColor + ' !important' }">hello</p>
627626
```
628627

629-
If you really need to override another `!important`, you must use the string syntax:
628+
Jika Anda ingin menimpa `!important` lainnya, Anda harus menggunakan <i>string syntax</i>:
630629

631630
``` html
632631
<p v-bind:style="'color: ' + myColor + ' !important'">hello</p>
633632
```
634633

635634
{% raw %}
636635
<div class="upgrade-path">
637-
<h4>Upgrade Path</h4>
638-
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of style bindings with <code>!important</code> in objects.</p>
636+
<h4>Jalur Upgrade</h4>
637+
<p>Jalankan <a href="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> pada baris kode Anda menemukan contoh-contoh dengan ikatan gaya <code>*!important*</code> dalam objek.</p>
639638
</div>
640639
{% endraw %}
641640

642-
### `v-el` and `v-ref` <sup>replaced</sup>
641+
### `v-el` and `v-ref` <sup>diganti</sup>
643642

644-
For simplicity, `v-el` and `v-ref` have been merged into the `ref` attribute, accessible on a component instance via `$refs`. That means `v-el:my-element` would become `ref="myElement"` and `v-ref:my-component` would become `ref="myComponent"`. When used on a normal element, the `ref` will be the DOM element, and when used on a component, the `ref` will be the component instance.
643+
Untuk kesederhanaan, `v-el` dan `v-ref` sudah digabungkan menjadi atribut `ref` , dapat diakses melalui komponen <i>instance</i> `$refs`. Maksudnya `v-el:my-element` akan muncul `ref="myElement"` dan `v-ref:my-component` nampak `ref="myComponent"`.Ketika digunakan pada elemen normal, `ref` akan ke DOM elemen, dan ketika menggunakan dalam komponen tersebut , `ref` akan kembali menggunakan komponen <i>instance</i>.
645644

646-
Since `v-ref` is no longer a directive, but a special attribute, it can also be dynamically defined. This is especially useful in combination with `v-for`. For example:
645+
Karena `v-ref` bukan lagi sebuah direktif, tetapi adalah atribut spesial, dapat juga didefinisikan secara dinamis. Ini sangat berguna dalam kombinasi dengan `v-for`. Seperti:
647646

648647
``` html
649648
<p v-for="item in items" v-bind:ref="'item' + item.id"></p>
650649
```
651650

652-
Previously, `v-el`/`v-ref` combined with `v-for` would produce an array of elements/components, because there was no way to give each item a unique name. You can still achieve this behavior by giving each item the same `ref`:
651+
Sebelumnya, `v-el`/`v-ref` kombinasi dengan `v-for` akan menghasilkan *array* pada elemen/komponen, karena tidak ada cara memberi nama yang unik pada setiap item. Anda masih dapat mencapai ini dengan memberikan *item* `ref` yang sama:
653652

654653
``` html
655654
<p v-for="item in items" ref="items"></p>
656655
```
657656

658-
Unlike in 1.x, these `$refs` are not reactive, because they're registered/updated during the render process itself. Making them reactive would require duplicate renders for every change.
657+
Tidak seperti 1.x, `$refs` ini tidak *reactive*, karena mereka sudah terdaftar/diperbaharui selama proses *render* itu sendiri. Membuat mereka *reactive* akan membutuhkan duplikasi *render* pada setiap perubahan.
659658

660-
On the other hand, `$refs` are designed primarily for programmatic access in JavaScript - it is not recommended to rely on them in templates, because that would mean referring to state that does not belong to the instance itself. This would violate Vue's data-driven view model.
659+
Disamping itu, `$refs` dirancang untuk program dalam javascript - Tidak disaranakan penggunaan dalam tampilan, karena akan merujuk pada negara bukan pada instance itu sendiri. Akan terkana pelanggaran dalam tampilan model Vue js sendiri.
661660

662661
{% raw %}
663662
<div class="upgrade-path">
664-
<h4>Upgrade Path</h4>
665-
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of <code>v-el</code> and <code>v-ref</code>.</p>
663+
<h4>Jalur Upgrade</h4>
664+
<p>Jalankan<a href="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> dari <i>codebase</i> untuk mencari contoh-contoh <code>v-el</code> dan <code>v-ref</code>.</p>
666665
</div>
667666
{% endraw %}
668667

669-
### `v-else` with `v-show` <sup>removed</sup>
668+
### `v-else` with `v-show` <sup>di hapus</sup>
670669

671-
`v-else` no longer works with `v-show`. Use `v-if` with a negation expression instead. For example, instead of:
670+
`v-else` tidak lagi berfungsi dengan `v-show`. Menggunakan `v-if` dengan sebuah ekpresi negasi sebagai gantinya. Untuk contohnya, daripada:
672671

673672
``` html
674673
<p v-if="foo">Foo</p>
675674
<p v-else v-show="bar">Not foo, but bar</p>
676675
```
677676

678-
You can use:
677+
Anda dapat menggunakan:
679678

680679
``` html
681680
<p v-if="foo">Foo</p>
@@ -684,8 +683,8 @@ You can use:
684683

685684
{% raw %}
686685
<div class="upgrade-path">
687-
<h4>Upgrade Path</h4>
688-
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of the <code>v-else</code> with <code>v-show</code>.</p>
686+
<h4>Jalur Upgrade</h4>
687+
<p>Jalankan <a href="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> dari <i>codebase</i> untuk mencari contoh-contoh <code>v-else</code> dengan <code>v-show</code>.</p>
689688
</div>
690689
{% endraw %}
691690

0 commit comments

Comments
 (0)