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/api/index.md
+24-24Lines changed: 24 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1509,102 +1509,102 @@ type: api
1509
1509
1510
1510
Berisi pemantau (*listeners*) *events* `v-on` yang berada di cakupan induk (parent) (tanpa pengubah (*modifiers*) `.native`). Properti ini dapat diteruskan kebawah ke komponen *inner* via `v-on="$listeners"` - berguna saat membuat komponen-komponen penyelubung (wrapper) yang bersifat transparan.
1511
1511
1512
-
## Instance Methods / Data
1512
+
## Metode Instance / Data
1513
1513
1514
1514
### vm.$watch( expOrFn, callback, [options] )
1515
1515
1516
-
- **Arguments:**
1516
+
- **Argumen:**
1517
1517
- `{string |Function} expOrFn`
1518
1518
- `{Function|Object} callback`
1519
1519
- `{Object} [options]`
1520
1520
- `{boolean} deep`
1521
1521
- `{boolean} immediate`
1522
1522
1523
-
- **Returns:** `{Function} unwatch`
1523
+
- **Mengembalikan:** `{Function} unwatch`
1524
1524
1525
1525
- **Penggunaan:**
1526
1526
1527
-
Watch an expression or a computed function on the Vue instance for changes. The callback gets called with the new value and the old value. The expression only accepts dot-delimited paths. For more complex expressions, use a function instead.
1527
+
Mengawasi suatu ekspresi atau fungsi penghitung (*computed function*) pada *instance* Vue untuk perubahan. *Callback* dipanggil dengan nilai baru dan nilai lama. Ekspresi hanya menerima jalur *dot-delimited*. Untuk ekspresi yang lebih kompleks, gunakan fungsi.
1528
1528
1529
-
<p class="tip">Note: when mutating (rather than replacing) an Object or an Array, the old value will be the same as new value because they reference the same Object/Array. Vue doesn't keep a copy of the pre-mutate value.</p>
1529
+
<p class="tip">Catatan: ketika memutasi (alih-alih mengganti) suatu Objek atau Array, nilai lama akan sama dengan nilai baru karena mereka mereferensikan Objek/Array yang sama. Vue tidak menyimpan salinan dari nilai pra-mutasi.</p>
1530
1530
1531
-
- **Example:**
1531
+
- **Contoh:**
1532
1532
1533
1533
``` js
1534
1534
// keypath
1535
1535
vm.$watch('a.b.c', function (newVal, oldVal) {
1536
-
//do something
1536
+
//lakukan sesuatu
1537
1537
})
1538
1538
1539
1539
// function
1540
1540
vm.$watch(
1541
1541
function () {
1542
-
//everytime the expression `this.a + this.b` yields a different result,
1543
-
//the handler will be called. It's as if we were watching a computed
1544
-
// property without defining the computed property itself
1542
+
//setiap kali ekspresi `this.a + this.b` menghasilkan hasil yang berbeda,
1543
+
// handler akan dipanggil. Seolah-olah kita sedang mengawasi properti
1544
+
//penghitung (computed property) tanpa mendefinisikan properti penghitung itu sendiri
1545
1545
returnthis.a+this.b
1546
1546
},
1547
1547
function (newVal, oldVal) {
1548
-
//do something
1548
+
//lakukan sesuatu
1549
1549
}
1550
1550
)
1551
1551
```
1552
1552
1553
-
`vm.$watch`returns an unwatch function that stops firing the callback:
1553
+
`vm.$watch`mengembalikan fungsi yang tidak diamati yang berhenti menembakkan *callback*:
1554
1554
1555
1555
``` js
1556
1556
var unwatch =vm.$watch('a', cb)
1557
-
//later, teardown the watcher
1557
+
//nanti, runtuhkan pengamat
1558
1558
unwatch()
1559
1559
```
1560
1560
1561
-
- **Option: deep**
1561
+
- **Opsi: deep**
1562
1562
1563
-
To also detect nested value changes inside Objects, you need to pass in `deep:true`in the options argument. Note that you don't need to do so to listen for Array mutations.
1563
+
Untuk mendeteksi perubahan nilai bersarang (*nested value*) di dalam Objek, anda harus mengoper `deep:true`dalam argumen opsi. Perhatikan bahwa anda tidak perlu mendengarkan (*listen*) untuk mutasi Array.
1564
1564
1565
1565
``` js
1566
1566
vm.$watch('someObject', callback, {
1567
1567
deep:true
1568
1568
})
1569
1569
vm.someObject.nestedValue=123
1570
-
// callback is fired
1570
+
// callback dieksekusi
1571
1571
```
1572
1572
1573
-
- **Option: immediate**
1573
+
- **Opsi: immediate**
1574
1574
1575
-
Passing in `immediate:true`in the option will trigger the callback immediately with the current value of the expression:
1575
+
Mengoper `immediate:true`dalam opsi akan segera memicu *callback* dengan nilai ekspresi saat ini:
1576
1576
1577
1577
``` js
1578
1578
vm.$watch('a', callback, {
1579
1579
immediate:true
1580
1580
})
1581
-
// `callback` is fired immediately with current value of `a`
1581
+
// `callback` segera dieksekusi dengan nilai `a` saat ini
0 commit comments