Skip to content

Commit 25d13bc

Browse files
gustialfianmazipan
authored andcommitted
Draft Opsi / Kait Siklus hidup (vuejs#121)
* Draft Opsi / Kait Siklus hidup * revisi 0
1 parent 4807280 commit 25d13bc

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

src/v2/api/index.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -792,17 +792,17 @@ type: api
792792

793793
- **Lihat juga:** [Render Functions](../guide/render-function.html)
794794

795-
## Options / Lifecycle Hooks
795+
## Opsi / Kait Siklus hidup
796796

797-
<p class="tip">All lifecycle hooks automatically have their `this` context bound to the instance, so that you can access data, computed properties, and methods. This means __you should not use an arrow function to define a lifecycle method__ (e.g. `created: () => this.fetchTodos()`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.fetchTodos` will be undefined.</p>
797+
<p class="tip">Semua kait siklus hidup secara otomatis terikat konteks `this` dengan *instance*, sehingga Anda bisa mengakses data, computed properties, dan methods. Ini berarti __Anda seharusnya tidak menggunakan *arrow function* saat mendefinisikan metode siklus hidup__ (e.g. `created: () => this.fetchTodos()`). Alasannya adalah *arrow function* mengikat konteks induk, jadi `this` tidak akan menjadi *instance* Vue seperti yang Anda harapkan dan `this.fetchTodos` akan undefined.</p>
798798

799799
### beforeCreate
800800

801801
- **Tipe:** `Function`
802802

803803
- **Detail:**
804804

805-
Called synchronously immediately after the instance has been initialized, before data observation and event/watcher setup.
805+
Dipanggil secara sinkron segera setelah *instance* diinisialisasi, sebelum pengaturan data observasi dan *event/watcher*.
806806

807807
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
808808

@@ -812,7 +812,7 @@ type: api
812812

813813
- **Detail:**
814814

815-
Called synchronously after the instance is created. At this stage, the instance has finished processing the options which means the following have been set up: data observation, computed properties, methods, watch/event callbacks. However, the mounting phase has not been started, and the `$el` property will not be available yet.
815+
Dipanggil secara sinkron setelah *instance* dibuat. Pada tahap ini, *instance* telah selesai memproses opsi yang berarti yang berikut telah diatur: data observasi, *computed properties*, *methods*, *watch/event callbacks*. Namun, tahap pemasangan belum dimulai, dan properti `$el` belum tersedia.
816816

817817
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
818818

@@ -822,9 +822,9 @@ type: api
822822

823823
- **Detail:**
824824

825-
Called right before the mounting begins: the `render` function is about to be called for the first time.
825+
Dipanggil tepat sebelum pemasangan dimulai: fungsi `render` akan dipanggil untuk pertama kalinya
826826

827-
**This hook is not called during server-side rendering.**
827+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
828828

829829
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
830830

@@ -834,20 +834,21 @@ type: api
834834

835835
- **Detail:**
836836

837-
Called after the instance has been mounted, where `el` is replaced by the newly created `vm.$el`. If the root instance is mounted to an in-document element, `vm.$el` will also be in-document when `mounted` is called.
837+
Dipanggil setelah *instance* telah terpasang, dimana `el` digantikan oleh `vm.$el` yang baru dibuat. Jika root instance sudah terpasang ke sebuah elemen pada dokumen, `vm.$el` juga akan di dokumen ketika `mounted` dipanggil.
838+
839+
Perhatikan bahwa `mounted` tidak menjamin bahwa semua komponen turunannya telah terpasang. Jika Anda ingin menunggu hingga seluruh tampilan telah di-*rander*, anda dapat menggunakan [vm.$nextTick](#vm-nextTick) di dalam `mounted`
838840

839-
Note that `mounted` does **not** guarantee that all child components have also been mounted. If you want to wait until the entire view has been rendered, you can use [vm.$nextTick](#vm-nextTick) inside of `mounted`:
840841

841842
``` js
842843
mounted: function () {
843844
this.$nextTick(function () {
844-
// Code that will run only after the
845-
// entire view has been rendered
845+
// Kode yang hanya akan berjalan setelah
846+
// seluruh tampilan telah di-render
846847
})
847848
}
848849
```
849850
850-
**This hook is not called during server-side rendering.**
851+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
851852
852853
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
853854
@@ -857,9 +858,9 @@ type: api
857858
858859
- **Detail:**
859860
860-
Called when data changes, before the DOM is patched. This is a good place to access the existing DOM before an update, e.g. to remove manually added event listeners.
861+
Dipanggil ketika data berubah sebelum DOM di-*patched*. Ini adalah tempat yang baik untuk mengakses DOM yang ada sebelum pembaruan, misalnya untuk menghapus *event listeners* yang ditambahkan secara manual.
861862
862-
**This hook is not called during server-side rendering, because only the initial render is performed server-side.**
863+
**Kait ini tidak dipanggil selama *rendering* di sisi server, karena hanya render awal yang dilakukan di sisi server.**
863864
864865
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
865866
@@ -869,22 +870,22 @@ type: api
869870
870871
- **Detail:**
871872
872-
Called after a data change causes the virtual DOM to be re-rendered and patched.
873+
Dipanggil setelah perubahan data menyebabkan *virtual DOM* diubah dan *patched*.
873874
874-
The component's DOM will have been updated when this hook is called, so you can perform DOM-dependent operations here. However, in most cases you should avoid changing state inside the hook. To react to state changes, it's usually better to use a [computed property](#computed) or [watcher](#watch) instead.
875+
*DOM* komponen akan diperbarui ketika kait ini dipanggil, sehingga Anda dapat melakukan operasi yang bergantung pada *DOM* di sini. Namun, dalam sebagian besar kasus, Anda harus menghindari perubahan *state* di dalam kait. Untuk bereaksi terhadap perubahan *state*, biasanya lebih baik menggunakan [computed property](#computed) atau [watcher](#watch).
875876
876-
Note that `updated` does **not** guarantee that all child components have also been re-rendered. If you want to wait until the entire view has been re-rendered, you can use [vm.$nextTick](#vm-nextTick) inside of `updated`:
877+
Perhatikan bahwa `updated` tidak menjamin bahawa semua komponen turunannya telah terpasang. Jika Anda ingin menunggu hingga seluruh tampilan telah di-*render*, anda dapat menggunakan [vm.$nextTick](#vm-nextTick) di dalam `mounted`
877878
878879
``` js
879880
updated: function () {
880881
this.$nextTick(function () {
881-
// Code that will run only after the
882-
// entire view has been re-rendered
882+
// Kode yang hanya akan berjalan setelah
883+
// seluruh tampilan telah di-render
883884
})
884885
}
885886
```
886887
887-
**This hook is not called during server-side rendering.**
888+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
888889
889890
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
890891
@@ -894,9 +895,9 @@ type: api
894895
895896
- **Detail:**
896897
897-
Called when a kept-alive component is activated.
898+
Dipanggil ketika komponen *kept-alive* diaktifkan.
898899
899-
**This hook is not called during server-side rendering.**
900+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
900901
901902
- **Lihat juga:**
902903
- [Built-in Components - keep-alive](#keep-alive)
@@ -908,9 +909,9 @@ type: api
908909
909910
- **Detail:**
910911
911-
Called when a kept-alive component is deactivated.
912+
Dipanggil ketika komponen *kept-alive* dinonaktifkan.
912913
913-
**This hook is not called during server-side rendering.**
914+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
914915
915916
- **Lihat juga:**
916917
- [Built-in Components - keep-alive](#keep-alive)
@@ -922,9 +923,9 @@ type: api
922923
923924
- **Detail:**
924925
925-
Called right before a Vue instance is destroyed. At this stage the instance is still fully functional.
926+
Dipanggil tepat sebelum *instance* Vue dihancurkan. Pada tahap ini *instance* masih berfungsi penuh.
926927
927-
**This hook is not called during server-side rendering.**
928+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
928929
929930
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
930931
@@ -934,33 +935,33 @@ type: api
934935
935936
- **Detail:**
936937
937-
Called after a Vue instance has been destroyed. When this hook is called, all directives of the Vue instance have been unbound, all event listeners have been removed, and all child Vue instances have also been destroyed.
938+
Dipanggil setelah *instance* Vue dihancurkan. Ketika kait ini dipanggil, semua *directives* dari *instance* Vue *unbound*, semua *event listeners* telah dihapus, dan semua turunan *instance* Vue juga telah dihancurkan.
938939
939-
**This hook is not called during server-side rendering.**
940+
**Kait ini tidak dipanggil selama *rendering* di sisi server.**
940941
941942
- **Lihat juga:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
942943
943944
### errorCaptured
944945
945-
> New in 2.5.0+
946+
> Baru di 2.5.0+
946947
947948
- **Tipe:** `(err: Error, vm: Component, info: string) => ?boolean`
948949
949950
- **Detail:**
950951
951-
Called when an error from any descendent component is captured. The hook receives three arguments: the error, the component instance that triggered the error, and a string containing information on where the error was captured. The hook can return `false` to stop the error from propagating further.
952+
Dipanggil ketika galat dari komponen turunan ditangkap. Kait menerima tiga argumen: Galatnya, *instance* komponen yang memicu galat, dan *string* yang memuat informasi dimana galat itu tertangkap. Kait dapat mengembalikan `false` untuk menghentikan galat agar tidak menyebar lebih lanjut.
952953
953-
<p class="tip">You can modify component state in this hook. However, it is important to have conditionals in your template or render function that short circuits other content when an error has been captured; otherwise the component will be thrown into an infinite render loop.</p>
954+
<p class="tip">Anda dapat mengubah state komponen dalam kait ini. Namun, penting untuk memiliki persyaratan dalam templat Anda atau fungsi *render* yang memiliki sirkuit pendek konten lain ketika galat telah ditangkap; jika tidak, komponen akan dilemparkan ke *loop render* yang tak terbatas.</p>
954955
955-
**Error Propagation Rules**
956+
**Aturan Propagasi Galat**
956957
957-
- By default, all errors are still sent to the global `config.errorHandler` if it is defined, so that these errors can still be reported to an analytics service in a single place.
958+
- Secara *default*, semua kesalahan masih dikirim ke `config.errorHandler` global jika sudah didefinisikan, sehingga galat ini masih dapat dilaporkan ke layanan analitik di satu tempat.
958959
959-
- If multiple `errorCaptured` hooks exist on a component's inheritance chain or parent chain, all of them will be invoked on the same error.
960+
- Jika ada beberapa kait `errorCaptured` pada rantai pewarisan atau rantai induk komponen, semuanya akan dipanggil pada kesalahan yang sama.
960961
961-
- If the `errorCaptured` hook itself throws an error, both this error and the original captured error are sent to the global `config.errorHandler`.
962+
- Jika kait `errorCaptured` itu sendiri melempar kesalahan, kesalahan ini dan kesalahan yang ditangkap asli dikirim ke `config.errorHandler` global.
962963
963-
- An `errorCaptured` hook can return `false` to prevent the error from propagating further. This is essentially saying "this error has been handled and should be ignored." It will prevent any additional `errorCaptured` hooks or the global `config.errorHandler` from being invoked for this error.
964+
- Kait `errorCaptured` dapat mengembalikan `false` untuk mencegah kesalahan agar tidak menyebar lebih lanjut. Ini pada dasarnya mengatakan "kesalahan ini telah ditangani dan harus diabaikan." Ini akan mencegah kait `errorCaptured` tambahan atau `global config.errorHandler` global agar tidak dipanggil untuk kesalahan ini.
964965
965966
## Options / Assets
966967

0 commit comments

Comments
 (0)