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/migration.md
+62-63Lines changed: 62 additions & 63 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,3 @@
1
-
---
2
1
title: Migrasi dari Vue 1.x
3
2
type: guide
4
3
order: 701
@@ -384,49 +383,51 @@ methods: {
384
383
</div>
385
384
{% endraw %}
386
385
387
-
## Built-In Directives
386
+
## Direktif Bawaan
387
+
388
+
### _Truthiness/Falsiness_ dengan `v-bind` <sup>diubah</sup>
388
389
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"`.
390
391
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"`.
392
392
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"`.
394
394
395
-
<pclass="tip">Note that for other directives (e.g. `v-if` and `v-show`), JavaScript's normal truthiness still applies.</p>
395
+
<pclass="tip">Catatan untuk direktif lainnya (e.g. `v-if` and `v-show`), nilai-nilai *truthiness* JavaScript masih berlaku.</p>
396
396
397
397
{% raw %}
398
398
<divclass="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>
401
401
</div>
402
402
{% endraw %}
403
403
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:
405
407
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:
<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>
416
417
</div>
417
418
{% endraw %}
418
419
419
-
### `debounce` Param Attribute for `v-model` <sup>removed</sup>
420
+
### `debounce`Atribut Param untuk `v-model` <sup>dihapus</sup>
420
421
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.
422
423
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:
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
+
470
472
471
473
```html
472
474
<!--
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.
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.
524
523
525
524
{% raw %}
526
525
<divclass="upgrade-path">
527
-
<h4>Upgrade Path</h4>
528
-
<p>Run the <ahref="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 <ahref="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> dari <i>codebase</i> Anda untuk mencari contoh-contoh atribut <code>*debounce*</code>.</p>
529
528
</div>
530
529
{% endraw %}
531
530
532
-
### `lazy`or`number` Param Attributes for `v-model` <sup>replaced</sup>
531
+
### `lazy`atau`number`Atribut Param untuk `v-model` <sup>diganti</sup>
533
532
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:
535
534
536
535
```html
537
536
<inputv-model="name"lazy>
538
537
<inputv-model="age"type="number"number>
539
538
```
540
539
541
-
You would use:
540
+
Kamu dapat menggunakan:
542
541
543
542
```html
544
543
<inputv-model.lazy="name">
@@ -547,135 +546,135 @@ You would use:
547
546
548
547
{% raw %}
549
548
<divclass="upgrade-path">
550
-
<h4>Upgrade Path</h4>
551
-
<p>Run the <ahref="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 <ahref="https://github.com/vuejs/vue-migration-helper">bantuan migrasi</a> dari <i>codebase</i> Anda untuk mencari contoh-contoh atribut .</p>
`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.
558
557
559
-
That means this element:
558
+
Maksud dari elemen ini:
560
559
561
560
```html
562
561
<inputv-model="text"value="foo">
563
562
```
564
563
565
-
backed by this data:
564
+
Didukung dengan data ini:
566
565
567
566
```js
568
567
data: {
569
568
text:'bar'
570
569
}
571
570
```
572
571
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:
574
573
575
574
```html
576
575
<textareav-model="text">
577
576
hello world
578
577
</textarea>
579
578
```
580
579
581
-
You should ensure your initial value for `text`is "hello world".
580
+
Anda harus memastikan nilai awal `text`adalah "hello world".
582
581
583
582
{% raw %}
584
583
<divclass="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>
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:
599
598
600
599
```js
601
600
strings.map(function (str) {
602
601
returncreateElement('input', ...)
603
602
})
604
603
```
605
604
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.
607
606
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:
609
608
610
609
{% codeblock lang:html %}
611
610
<inputv-for="obj in objects"v-model="obj.str">
612
611
{% endcodeblock %}
613
612
614
613
{% raw %}
615
614
<divclass="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>
<p>Run the <ahref="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 <ahref="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>
639
638
</div>
640
639
{% endraw %}
641
640
642
-
### `v-el` and `v-ref` <sup>replaced</sup>
641
+
### `v-el` and `v-ref` <sup>diganti</sup>
643
642
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>.
645
644
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:
647
646
648
647
```html
649
648
<pv-for="item in items"v-bind:ref="'item' + item.id"></p>
650
649
```
651
650
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:
653
652
654
653
```html
655
654
<pv-for="item in items"ref="items"></p>
656
655
```
657
656
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.
659
658
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.
661
660
662
661
{% raw %}
663
662
<divclass="upgrade-path">
664
-
<h4>Upgrade Path</h4>
665
-
<p>Run the <ahref="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<ahref="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>
666
665
</div>
667
666
{% endraw %}
668
667
669
-
### `v-else` with `v-show` <sup>removed</sup>
668
+
### `v-else` with `v-show` <sup>di hapus</sup>
670
669
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:
672
671
673
672
```html
674
673
<pv-if="foo">Foo</p>
675
674
<pv-elsev-show="bar">Not foo, but bar</p>
676
675
```
677
676
678
-
You can use:
677
+
Anda dapat menggunakan:
679
678
680
679
```html
681
680
<pv-if="foo">Foo</p>
@@ -684,8 +683,8 @@ You can use:
684
683
685
684
{% raw %}
686
685
<divclass="upgrade-path">
687
-
<h4>Upgrade Path</h4>
688
-
<p>Run the <ahref="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 <ahref="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>
0 commit comments