diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000000..f5c4dfd451 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,59 @@ +{ + "projectName": "docs", + "projectOwner": "vuejs-id", + "repoType": "github", + "repoHost": "https://github.com/", + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + { + "login": "mul14", + "name": "Mulia Nasution", + "avatar_url": "https://avatars2.githubusercontent.com/u/113989?v=4", + "profile": "http://nasution.id/", + "contributions": [ + "translation" + ] + }, + { + "login": "mazipan", + "name": "Irfan Maulana", + "avatar_url": "https://avatars0.githubusercontent.com/u/7221389?v=4", + "profile": "https://www.mazipan.xyz/", + "contributions": [ + "translation" + ] + }, + { + "login": "isatrio", + "name": "Yudhi Satrio", + "avatar_url": "https://avatars2.githubusercontent.com/u/1897570?v=4", + "profile": "http://me.linkaran.com/", + "contributions": [ + "translation" + ] + }, + { + "login": "nusendra", + "name": "Nusendra Hanggarawan", + "avatar_url": "https://avatars1.githubusercontent.com/u/8466308?v=4", + "profile": "https://nusendra.com/", + "contributions": [ + "translation" + ] + }, + { + "login": "mandaputtra", + "name": "protokol0", + "avatar_url": "https://avatars1.githubusercontent.com/u/23342943?v=4", + "profile": "http://mandaputtra.github.io/", + "contributions": [ + "translation" + ] + } + ], + "contributorsPerLine": 7 +} diff --git a/ALL_CONTRIBUTOR_ID.md b/ALL_CONTRIBUTOR_ID.md new file mode 100644 index 0000000000..d05128e214 --- /dev/null +++ b/ALL_CONTRIBUTOR_ID.md @@ -0,0 +1,11 @@ +# Contributors + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + +
Mulia Nasution
Mulia Nasution

🌍
Irfan Maulana
Irfan Maulana

🌍
Yudhi Satrio
Yudhi Satrio

🌍
Nusendra Hanggarawan
Nusendra Hanggarawan

🌍
protokol0
protokol0

🌍
+ + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md new file mode 100644 index 0000000000..e83a57ab24 --- /dev/null +++ b/CONTRIBUTION.md @@ -0,0 +1,39 @@ +# Halaman Panduan Berkontribusi + +Beberapa panduan yang harus diikuti bila ingin ikut berkontribusi pada proses penerjemahan dokumentasi Vue.js ke dalam Bahasa Indonesia + +## Pengurus Utama + ++ [@mul14](https://github.com/mul14), Telegram: [@mul14](https://t.me/@mul14) ++ [@mazipan](https://github.com/mazipan), Telegram: [@mazipan](https://t.me/@mazipan) ++ [@nusendra](https://github.com/nusendra), Telegram: [@nusendra](https://t.me/@nusendra) ++ [@isatrio](https://github.com/isatrio), Telegram: [@isatrio](https://t.me/@isatrio) + +## Kontribusi Menerjemahkan + ++ Silakan fork dari repositori ini, bila belum mengerti cara `fork` silakan baca artikel https://help.github.com/articles/fork-a-repo/ ++ Sebelum memulai proses, pastikan anda melihat halaman **[issues](https://github.com/vuejs-id/docs/issues)** untuk mengecek apakah sudah ada yang mengerjakan halaman tersebut atau belum. ++ Setiap halaman akan memiliki *issue* tersendiri, jika *issue* tersebut belum di *assign* ke seseorang berarti belum ada yang mengerjakan halaman tersebut. ++ Silakan tambahkan komentar pada *issue* dari halaman yang ingin Anda kerjakan. Pastikan mention salah satu pengurus. Mas [@mul14](https://github.com/mul14), [@nusendra](https://github.com/nusendra) atau [@mazipan](https://github.com/mazipan) untuk *assign* *issue* tersebut. ++ Branch yang menjadi panduan adalah branch `master`. ++ Buat branch dari base branch dengan nama halaman yang kalian terjemahkan, misalkan `introduction`. Bila belum mengerti bagaimana membuat branch silakan baca artikel [https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/) ++ Pastikan kalian sudah membaca [kamus berbagai istilah asing](GLOSARIUM.md) yang kami kumpulkan. Kemungkinan besar kalian akan bertemu dengan berbagai kata tersebut, ada baiknya kalau kalian mengenalnya terlebih dahulu. ++ Setelah selesai menerjemahkan, silakan buat Pull Request ke branch `master` pada repositori ini. ++ Jangan lupa untuk menyertakan komentar nomor Pull Request yang dibuat lewat komentar di dalam issue agar saling terkait antara Issue dan Pull Request. ++ Para pengurus dan teman-teman lain akan membantu melakukan review pada Pull Request kalian, bila semuanya sudah bagus maka dengan segera bisa di `merge` ke branch `master`. ++ Kami tidak memperkenankan kalian mengerjakan lebih dari satu halaman pada satu waktu untuk tetap menjaga fokus, pastikan selesaikan terlebih dahulu halaman yang sudah kalian ambil sebelumnya. Pastikan halaman tersebut selesai dan telah di merge, setelahnya baru kalian boleh mengambil issue lain. + +> Note : Usahakan ketika menerjemahkan menggunakan kalimat Indonesia yang natural (Mudah dibaca, tidak seperti terjemahan mentah yang kaku ala Google translate) + +## Kontribusi Lain + +Bila kalian tidak terbiasa dengan proses menerjemahkan dengan Git, mungkin akan mengalami kesulitan dalam mengikuti `git flow` yang kita tentukan. Jangan khawatir, kalian masih bisa berkontribusi tanpa harus ikut menerjemahkan sebuah halaman. Berikut beberepa kontribusi yang bisa kalian berikan pada kami: + ++ Berikan ⭐️ pada repositori ini. ++ Sebarkan berita mengenai proses menerjemahkan dokumentasi ini agar ada teman lain yang sanggup dan ingin membantu proses menerjemahkan. ++ Bantu para pengurus melakukan review pada halaman [Pull Request](https://github.com/vuejs-id/docs/pulls) agar kualitas terjemahan bisa dijaga dengan baik. ++ Bergabung dengan komunitas Vue.js Indonesia di [Facebook](https://www.facebook.com/groups/1675298779418239/), [Telegram](https://t.me/vuejsid) dan [Medium](https://medium.com/vuejs-id). + +## Beberapa pertanyaan umum + +Silakan baca di halaman [Pertanyaan Umum](FAQ.md) diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000000..4125f41127 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,4 @@ +# Beberapa pertanyaan umum mengenai proses penerjemahan + +## Q +A: diff --git a/GLOSARIUM.md b/GLOSARIUM.md new file mode 100644 index 0000000000..3c94783081 --- /dev/null +++ b/GLOSARIUM.md @@ -0,0 +1,228 @@ +# Kamus Perbendaharaan Istilah Asing + +📚 Kamus perbendaharaan kata asing yang akan sering ditemukan ketikan menerjemahkan dokumentasi resmi Vue.js. + +## Sumber yang akan membantu Anda menerjemahkan + +- [PUEBI](https://puebi.readthedocs.io/en/latest/) +- [KBBI Kemdigbud](https://kbbi.kemdikbud.go.id/) +- [Kateglo.com](http://kateglo.com/) +- [Hukum Diterangkan Menerangkan](https://rubrikbahasa.wordpress.com/2003/09/01/hukum-dm-dalam-bahasa-indonesia/) + +## Navigasi Berdasarkan Abjad + ++ [A](#a), [B](#b), [C](#c), [D](#d), [E](#e), [F](#f), ++ [G](#g), [H](#h), [I](#i), [J](#j), [K](#k), [L](#l), ++ [M](#m), [N](#n), [O](#o), [P](#p), [Q](#q), [R](#r), ++ [S](#s), [T](#t), [U](#u), [V](#v), [W](#w), [X](#x), ++ [Y](#y), [Z](#z) + +## A + +- Analyze: Analisis +- Argument: Argumen +- Attribute: Atribut + +[⬆️](#navigasi-berdasarkan-abjad) + +## B + +- Bind: *Bind* +- Browser: Peramban + +[⬆️](#navigasi-berdasarkan-abjad) + +## C + +- Case: Aturan Huruf +- Chain: Rantai (atau bisa dengan tetap *Chain*) +- Child: Anak +- Component: Komponen +- Compile: Menyusun/Menghimpun +- Console: Konsol +- Constructor: Konstruktor +- Custom: Khusus + +[⬆️](#navigasi-berdasarkan-abjad) + +## D + +- Default: Bawaan +- Default Value: Nilai Anggapan +- Define: Mendefinisikan +- Development: Developmen, Pengembangan, Pembuatan (Pilih senatural mungkin) +- Deploy: Menggelar (Tetap diikuti dengan bahasa inggris asli italic dan dalam kurung) +- Deployment: Penggelaran (Tetap diikuti dengan bahasa inggris asli italic dan dalam kurung) +- Directive: Direktif + +[⬆️](#navigasi-berdasarkan-abjad) + +## E + +- E.g. (exempli gratia / for example): Sebagai Contoh +- Element: Elemen +- Error: Galat +- Event: *Event* +- Extracted: Diekstraksi +- Export: Ekspor +- Expression: Ekspresi + +[⬆️](#navigasi-berdasarkan-abjad) + +## F + +- File: Berkas +- Framework: Kerangka kerja +- Function: *Function* + +[⬆️](#navigasi-berdasarkan-abjad) + +## G + +- Gotcha: Rintangan / Halangan + +[⬆️](#navigasi-berdasarkan-abjad) + +## H + +- Hook: Kait (untuk beberapa konteks Anda perlu tetap menggunakan Hook dengan font miring) + +[⬆️](#navigasi-berdasarkan-abjad) + +## I + +- I.e. (id est / in other words): Dengan kata lain +- Import: Impor +- Inception: Permulaan +- Index: Indeks +- Inheritance: Pewarisan +- Instance: *Instance* +- Instantiate: *Instantiate* +- Interpolation: Interpolasi + +[⬆️](#navigasi-berdasarkan-abjad) + +## J + + +[⬆️](#navigasi-berdasarkan-abjad) + +## K + +- Key: *Key* + +[⬆️](#navigasi-berdasarkan-abjad) + +## L + +- Library: Pustaka +- Lifecycle: Siklus Hidup +- Listener: Pemantau (pada beberapa konteks mungkin tidak cocok, bisa dipertimbangkan menggunakan *listener*) + +[⬆️](#navigasi-berdasarkan-abjad) + +## M + +- Modifier: Pengubah +- Mount: Pasang +- Mutate: Memutasi + +[⬆️](#navigasi-berdasarkan-abjad) + +## N + +- Nested: Bersarang + +[⬆️](#navigasi-berdasarkan-abjad) + +## O + +- Object: Objek +- Option: Opsi (beberapa konteks harus diartikan "Pilihan") + +[⬆️](#navigasi-berdasarkan-abjad) + +## P + +- Parent: Induk +- Passing: Mengoper +- Path: Jalur +- Piece-by-piece: Sepotong-sepotong +- Project: Proyek +- Property: Properti +- Props: Props + +[⬆️](#navigasi-berdasarkan-abjad) + +## Q + + +[⬆️](#navigasi-berdasarkan-abjad) + +## R + +- Refactor: *Refactor* +- Render: *Render* +- Return: Mengembalikan +- Router: *Router* + + +[⬆️](#navigasi-berdasarkan-abjad) + +## S + +- Section: Bagian/Seksi +- Set: Menetapkan +- Shorthand: Tulisan cepat (tambahkan imbuhan sesuai dengan konteks jika diperlukan) +- String: Untai +- Style: Gaya +- Style Guide: Panduan Gaya +- Single Page Application: Aplikasi *Single-Page* +- Single File Component: Komponen Berkas Tunggal (untuk penggunaan pertama kali dalam halaman tersebut, sertakan kata aslinya di dalam kurung) +- Statement: Statemen +- Syntax: Sintaksis + + +[⬆️](#navigasi-berdasarkan-abjad) + +## T + +- Template: Templat +- Trigger: Picu (memicu/dipicu) + +[⬆️](#navigasi-berdasarkan-abjad) + +## U + +- Update: Pembaruan - Updated: Diperbarui + +[⬆️](#navigasi-berdasarkan-abjad) + +## V + +- Value: Nilai +- Virtual DOM: DOM Virtual +- + +[⬆️](#navigasi-berdasarkan-abjad) + +## W + + +[⬆️](#navigasi-berdasarkan-abjad) + +## X + + +[⬆️](#navigasi-berdasarkan-abjad) + +## Y + +- You: Anda + +[⬆️](#navigasi-berdasarkan-abjad) + +## Z + + +[⬆️](#navigasi-berdasarkan-abjad) diff --git a/README.md b/README.md index db4b5ba602..6869da49ad 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,56 @@ -# vuejs.org +# 🇮🇩 Dokumentasi resmi Vue.js dalam Bahasa Indonesia +[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors) -This site is built with [hexo](http://hexo.io/). Site content is written in Markdown format located in `src`. Pull requests welcome! +Halaman ini dibuat menggunakan [hexo](http://hexo.io/). Konten ditulis menggunakan _Markdown_ dan diletakkan pada direktori `src`. _*Pull requests*_ Anda sangat kami tunggu! -## Developing +## Website +Dokumentasi bisa diakses di halaman web situs [http://docs.vuejs.id](http://docs.vuejs.id) + +## Proses Development + +Jika anda menggunakan NPM ``` bash +# npm $ npm install -$ npm start # dev server at http://localhost:4000 +$ npm start # dev server di http://localhost:4000 ``` -## Deploying - -The site is automatically deployed when commits land in `master`, via [Netlify](https://www.netlify.com/). - -If you are the maintainer of a community translation fork and would like to deploy via Netlify instead of GitHub pages, please ping @yyx990803 in an issue to request a Netlify team membership and DNS update. - -## On Translations - -Translation for this documentation project are currently maintained in separate repositories forked from this original one. - -### French - -French translation is maintained by Vuejs-FR. - -* Translation Repo - [/vuejs-fr/vuejs.org](https://github.com/vuejs-fr/vuejs.org) - -### Italian - -* Translation Repo - [/vuejs/it.vuejs.org](https://github.com/vuejs/it.vuejs.org) - -### Japanese - -Japanese translation is maintained by [Vue.js japan user group](https://github.com/vuejs-jp) - -* Translation Repo - [/vuejs/jp.vuejs.org](https://github.com/vuejs/jp.vuejs.org) -* Primary maintainer - [kazupon](https://github.com/kazupon) -* Secondary Maintainers: - * [re-fort](https://github.com/re-fort) - * [potato4d](https://github.com/potato4d) - -### Korean - -Korean translation is maintained by [Vue.js Korean User group](https://github.com/vuejs-kr). - -* Translation Repo - [/vuejs-kr/kr.vuejs.org](https://github.com/vuejs-kr/kr.vuejs.org) -* Primary maintainer - [ChangJoo Park](https://github.com/ChangJoo-Park) - -### Mandarin - -* Translation Repo - [/vuejs/cn.vuejs.org](https://github.com/vuejs/cn.vuejs.org) - -### Persian (Farsi) - -Persian translation is maintained by VueJS-fa. - -* Translation Repo - [/vuejs-fa/fa.vuejs.org](https://github.com/vuejs-fa/fa.vuejs.org) -* Primary maintainer - [Pooya Parsa](https://github.com/pi0) +Jika anda menggunakan Yarn +``` bash +$ yarn +$ yarn start # dev server at http://localhost:4000 +``` -### Português-Br +## Kontribusi -Português-Br translation is maintained by [Vuejs-Br](https://github.com/vuejs-br). +Silakan lihat di halaman [Panduan Berkontribusi](CONTRIBUTION.md) -* Translation Repo - [/vuejs-br/br.vuejs.org](https://github.com/vuejs-br/br.vuejs.org) +## Kamus Perbendaharaan Istilah -### Russian +Silakan lihat di halaman [Kamus Perbendaharaan Istilah](GLOSARIUM.md) -Russian translation is maintained by Translation Gang. +## Progres -* Translation Repo - [/translation-gang/ru.vuejs.org](https://github.com/translation-gang/ru.vuejs.org) -* Primary maintainer - [Grigoriy Beziuk](https://gbezyuk.github.io) +Silakan lihat di halaman [Milestone](https://github.com/vuejs-id/docs/milestones) dan [Issues](https://github.com/vuejs-id/docs/issues). -### Spanish -Spanish translation is maintained by [1950Labs](https://1950labs.com) and Vue.js Montevideo ([Leonel More](https://twitter.com/leonelmore), [Sebastian Camacho](https://twitter.com/sxcamacho), and [Diana Rodriguez](https://vue.beingadev.rocks). +## Beberapa pertanyaan umum -* Translation Repo - [/1950Labs/vuejs.org](https://github.com/1950Labs/vuejs.org) +Silakan baca di halaman [Pertanyaan Umum](FAQ.md) -### Vietnamese +---- -Vietnamese translation is maintained by [Vue.js Vietnam User group](https://github.com/vuejs-vn/). +Diterjemahkan oleh komunitas [Vue.js Indonesia](https://github.com/vuejs-id/) dengan dukungan banyak [kontributor](https://github.com/vuejs-id/docs/graphs/contributors) hebat. -* Translation Repo: [/vuejs-vn/vuejs.org](https://github.com/vuejs-vn/vuejs.org) -* Primary maintainer - [phanan](https://github.com/phanan) +## Contributors -### Want to help with the translation? +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): -If you feel okay with translating sorta alone, you can fork the repo, create a "work-in-progress" issue to inform others that you're doing the translation, and go for it. + + +
Mulia Nasution
Mulia Nasution

🌍
Irfan Maulana
Irfan Maulana

🌍
Yudhi Satrio
Yudhi Satrio

🌍
Nusendra Hanggarawan
Nusendra Hanggarawan

🌍
Manda Putra
Manda Putra

🌍
-If you are more of a team player, Translation Gang might be for you. Let us know somehow that you're ready to join this international open-source translators community. Feel free to contact [Grigoriy Beziuk](https://gbezyuk.github.io) or anybody else from [the team](https://github.com/orgs/translation-gang/people). + -And thank you in advance ;) +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file diff --git a/package.json b/package.json index 030bfdfb41..e3640cc3fa 100644 --- a/package.json +++ b/package.json @@ -29,4 +29,4 @@ "hoek": "^6.1.2", "request": "^2.85.0" } -} +} \ No newline at end of file diff --git a/src/_posts/011-component.md b/src/_posts/011-component.md index c95230e530..e3dc6ca049 100644 --- a/src/_posts/011-component.md +++ b/src/_posts/011-component.md @@ -1,61 +1,61 @@ ---- -title: 0.11 Component Tips -date: 2014-12-08 15:02:14 -tags: ---- - -

Note: this post contains information for the outdated 0.11 version. Please refer to the [0.12 release notes](https://github.com/yyx990803/vue/releases) for the changes in the API.

- -The release of 0.11 introduced [many changes](https://github.com/yyx990803/vue/blob/master/changes.md), but the most important one is how the new component scope works. Previously in 0.10.x, components have inherited scope by default. That means in a child component template you can reference parent scope properties. This often leads to tightly-coupled components, where a child component assumes knowledge of what properties are present in the parent scope. It is also possible to accidentally refer to a parent scope property in a child component. - - - -### Isolated Scope and Data Passing - -Starting in 0.11, all child components have isolated scope by default, and the recommended way to control component data access is via [Explicit Data Passing](/guide/components.html#Explicit_Data_Passing) using [`v-with`](/api/directives.html#v-with) or [`paramAttributes`](/api/options.html#paramAttributes). - -`paramAttributes` enables us to write Web Component style templates: - -``` js -Vue.component('my-component', { - paramAttributes: ['params'], - compiled: function () { - console.log(this.params) // passed from parent - } -}) -``` - -``` html - -``` - -### Where Does It Belong? - -Previously in 0.10, all directives on a component's container element are compiled in the child component's scope. Because it inherited parent scope, this worked in most situations. Starting in 0.11.1, we want to provide a cleaner separation between component scopes. The rule of thumbs is: if something appears in the parent template, it will be compiled in parent scope; if it appears in child template, it will be compiled in child scope. For example: - -``` html - -
-

{{parentMessage}}

-
-``` - -``` html - -
-

{{childMessage}}

- -
-``` - -Everything in the parent template will be compiled in the parent's scope, including the content that's going to be inserted into the child component. - -The only exception to the rule is `v-with` (and `paramAttributes` which compiles down to `v-with`), which works in both places - so you don't need to worry about it too much. - -### Cleaner Event Communication - -Previously the standard way for a child component to communicate to its parent is via dispatching events. However, with this approach, the event listeners on the parent component are not guaranteed to be listening on the desired child component only. It's also possible to trigger undesired listeners further up the chain if we do not cancel the event. - -The most common use case is for a parent to react to the events from a specific, direct child component. So in 0.11.4, [a new directive `v-events`](/api/directives.html#v-events) has been introduced to enable exactly this behavior. - -0.11.4 has already been released, go try it out! +--- +title: 0.11 Component Tips +date: 2014-12-08 15:02:14 +tags: +--- + +

Note: post ini berisi informasi untuk versi lama 0.11. Silahkan lihat [0.12 release notes](https://github.com/yyx990803/vue/releases) untuk melihat perubahan pada API.

+ +Perilisan dari 0.11 memperkenalkan [banyak perubahan](https://github.com/yyx990803/vue/blob/master/changes.md), tapi yang paling penting adalah bagaimana cara ruang lingkup komponen baru bekerja. Sebelumnya di 0.10.x, komponen mempunyai ruang linkup yang diwariskan sebagai settingan awal. Itu berarti di sebuah template child komponen kalian bisa menghubungkan properti ruang lingkup parent. Ini biasanya berakhir pada komponen dengan hubungan erat, dimana child komponen mengira-ngira pengetahuan dari properti apa yang ada di ruang lingkup parent. Ada juga kemungkinan untuk properti ruang lingkup parent tidak sengaja merujuk di komponen child. + + + +### Isolasi Ruang Lingkup dan Pengiriman Data + +Dimulai di 0.11, semua komponen child punya ruang lingkup terisolasi sebagai settingan awal, dan cara yang disarankan untuk mengendalikan kompenen akses data adalah lewat [Pengiriman Data Jelas](/guide/components.html#Explicit_Data_Passing) menggunakan [`v-with`](/api/directives.html#v-with) atau [`paramAttributes`](/api/options.html#paramAttributes). + +`paramAttributes` memperbolehkan kita untuk menulis template komponen tampilan web: + +``` js +Vue.component('my-component', { + paramAttributes: ['params'], + compiled: function () { + console.log(this.params) // diwariskan dari parent + } +}) +``` + +``` html + +``` + +### Darimana Asalnya? + +Sebelumnya di 0.10, semua arahan pada elemen wadah komponen dikompilasi di komponen ruang lingkup child. Karena mewariskan ruang lingkup parent, hal ini sering bekerja di beberapa situasi. Dimulai di 0.11.1, kita ingin menyediakan pemisahan yang lebih rapi antara komponen ruang lingkup. Peraturan thumbs adalah: jika sesuatu muncul di template parent, itu akan dikompilasi di ruang lingkup parent; jika itu muncul di template child, itu akan dikompilasi di ruang lingkup child. Sebagai contoh: + +``` html + +
+

{{Pesanparent}}

+
+``` + +``` html + +
+

{{Pesanchild}}

+ +
+``` + +Segala hal yang ada di template parent akan dikompilasi di ruang lingkup parent, termasuk konten yang akan dimasukkan ke dalam komponen child. + +Satu-satunya pengecualian pada peraturannya adalah `v-with` (dan `paramAttributes` yang dikompilasi menjadi `v-with`), dimana bekerja di kedua tempat - jadi kalian tidak perlu terlalu mencemaskannya. + +### Komunikasi Event yang Lebih Rapi + +Sebelumnya cara standar untuk sebuah komponen child untuk berkomunikasi dengan parent adalah lewat event pelepasan. Namun, dengan cara ini, pendengar event di komponen parent tidak terjamin untuk hanya mendengarkan komponen child yang diinginkan. Dan juga berkemungkinan untuk memicu pendengar yang tidak diinginkan masuk lebih dalam jika kita tidak membatalkan the event. + +Kasus penggunaan yang paling umum adalah untuk parent bereaksi ke events dari sebuah spesifik, komponen child langsung. Jadi di 0.11.4, [arahan baru `v-events`](/api/directives.html#v-events) telah diperkenalkan untuk mengaktifkan perilaku ini. + +0.11.4 sudah rilis, cobalah! diff --git a/src/_posts/012-release.md b/src/_posts/012-release.md index ea002a9688..da623f5a82 100644 --- a/src/_posts/012-release.md +++ b/src/_posts/012-release.md @@ -3,88 +3,88 @@ title: Vue.js 0.12 released! date: 2015-06-11 17:37:30 --- -I'm really excited to announce that [Vue.js 0.12: Dragon Ball](https://github.com/yyx990803/vue/releases/tag/0.12.0) is finally here! Thanks to everyone who tried out the beta/rc versions and provided feedback / bug reports along the way. +Saya sangat bersemangat untuk mengumumkan bahwa [Vue.js 0.12: Dragon Ball](https://github.com/yyx990803/vue/releases/tag/0.12.0) akhirnya selesai. Terima kasih kepada seluruh pihak yang telah mencoba versi beta/rc dan memberikan feedback / laporan bug selama penggunaan. -There's a lot to cover in this release, and we will talk about a few highlights below. However, it is still recommended to carefully go through the [Full Release Note](https://github.com/yyx990803/vue/releases/tag/0.12.0) and updated docs if you are upgrading from 0.11. You can report bugs on GitHub, send questions to [vuejs/Discussion](https://github.com/vuejs/Discussion/issues), or join us in the [Gitter chat channel](https://gitter.im/yyx990803/vue). +Ada banyak hal yang harus dibahas pada perilisan ini, dan kami akan berbicara tentang bebrapa hal-hal yang penting dibawah ini. Namun, alangkah baiknya untuk tetap mengikuti [Catatan Rilis Lengkap](https://github.com/yyx990803/vue/releases/tag/0.12.0) dan perbarui dokumen jika kamu meningkatkan dari 0.11. Kamu dapat melaporkan bug di Github, mengirim pertanyaan ke [vuejs/Discussion](https://github.com/vuejs/Discussion/issues), atau bergabung dengan kami di [Gitter chat channel](https://gitter.im/yyx990803/vue). -### More Consistent Component Syntax +### Komponen Sintaks Lebih Konsisten -Previously in 0.11 you have two ways to use a Vue.js component: using the `v-component` directive, or using custom elements. There are also two ways to pass data down to child components: using the `v-with` directive, or using the `paramAttributes` option. Although both custom elements and param attributes get compiled down to directives eventually, it is confusing and redundant to have two sets of syntax for the same functionality. +Sebelumnya di 0.11 Anda memiliki dua cara untuk menggunakan komponen Vue.js: menggunakan `v-component` secara langsung, atau menggunakan elemen khusus. Terdapat juga dua cara untuk meneruskan data ke komponen child: menggunakan `v-with` secara langsung, atau menggunakan opsi `paramAttributes`. Meskipun kedua elemen khusus dan atribut parameter dapat dikomplikasi, itu membingungkan dan berlebihan untuk memiliki dua set sintaks untuk fungsi yang sama. -In addition, it should be noted that the component system is a first-class concept in Vue.js, even more important than directives. It defines how we encapsulate our higher-level view logic and compose our application. In the meanwhile, having a clear and declarative way to pass data into child components is also very important. Components and param attributes really deserve their own dedicated syntax to differentiate from other directives. +Selain itu, perlu dicatat bahwa sistem komponen adalah konsep kelas pertama dalam Vue.js, bahkan lebih penting. Ini mendefinisikan bagaimana kita merangkum logika tampilan tingkat yang lebih tinggi dan menyusun aplikasi kita. Sementara itu, memiliki cara yang jelas dan deklaratif untuk meneruskan data ke dalam komponen tururnan itu juga sangat penting. Komponen dan atribut parameter memilik sintaksis khusus mereka sendiri untuk membedakannya dari yang lainnya. -As a result, `v-component` and `v-with` have been deprecated in 0.12. `paramAttributes` has also been renamed to `props`, which is shorter and cleaner. From now on, most Vue.js components will look like this: +Hasil dari, `v-component` dan `v-with` sudah tidak digunakan lagi di 0.12. `paramAttributes` juga diubah namanya menjadi `props`, yang lebih pendek dan lebih bersih. Mulai sekarang, kebanyakan komponen Vue.js akan terlihat seperti ini: ``` html ``` -There are also additional props-related improvements such as explicit one-time or one-way props, expression as props, methods as prop callbacks and more. You can find out more details in the 0.12 release notes linked above and the updated [Component System](/guide/components.html) section of the guide. +Ada juga alat peraga tambahan terkait seperti alat peraga satu kali atau satu arah yang jelas, ekspresi sebagai alat peraga, metode sebagai callback prop dan lebih banyak lagi. Anda dapat mengetahui lebih detail di catatan rilis 0.12 terkait di atas dan perbaruan [Sistem Komponen](/guide/components.html) pada panduan ini. -### Filter Arguments Improvements +### Filter Perbaikan Argumen -In 0.11, filters always receive their arguments as plain strings. An argument can be enclosed in quotes to include whitespace, but the quotes are not automatically stripped when passed into the filter function. Some users were also confused about how to retrieve a dynamic value on the vm instead of a plain string. +Di 0,11, filter selalu menerima argumen mereka sebagai string biasa. Argumen dapat diapit dalam tAnda kutip untuk menyertakan spasi putih, tetapi tAnda kutip tidak secara otomatis dihapus ketika diteruskan ke fungsi filter. Beberapa pengguna juga bingung tentang cara mengambil nilai dinamis pada vm bukan string biasa. -In 0.12, the filter argument syntax now follows a simple rule: if an argument is enclosed in quotes, it will be passed in as a plain string; otherwise, it will be evaluated against the current vm as a dynamic value. +Dalam 0,12, sintaks argumen filter mengikuti aturan sederhana: jika argumen diapit oleh tAnda kutip, maka akan dilewatkan sebagai string biasa; jika tidak, ini akan dievaluasi terhadap vm saat ini sebagai nilai dinamis. -This means the usage of some existing filters will have to change: +Ini berarti penggunaan beberapa filter yang ada harus berubah: ``` html {{ items.length | pluralize 'item' }} ``` -But it would make custom filters that rely on dynamic values much easier to write: +Tapi itu akan membuat filter khusus yang bergantung pada nilai dinamis jauh lebih mudah untuk ditulis: ``` html {{ msg | concat otherMsg }} ``` -Here the first argument to the `concat` filter will be the value of `this.otherMsg`. +Disini argumen pertama ke filter `concat` akan menjadi nilai dari `this.otherMsg`. -### Asynchronous Components +### Komponen Asinkron -It is common practice to bundle all the JavaScript into one file when building large single page applications. But when the file becomes too large, we may want to defer loading parts of our application for a faster initial load. However, this does pose some constraints on how the application architecture should be designed. It could be very tricky to figure out how to properly split up your JavaScript bundles. +Ini adalah praktik khusus untuk menggabungkan seluruh JavaScript kedalam satu file ketika membangun aplikasi satu halaman besar. Tetapi ketika file terlalu besar, kami mungkin ingin menunda memuat bagian dari aplikasi kami untuk beban awal yang lebih cepat. Namun, ini memang menimbulkan beberapa kendala tentang bagaimana arsitektur aplikasi harus dirancang. Itu bisa sangat rumit untuk mencari tahu bagaimana cara yang benar untuk memecah kumpulan JavaScript Anda. -Well, with Vue.js we can already build our applications as decoupled components. If we can lazily load a dynamic component only when it is needed, wouldn't it be awesome? As a matter of fact, in 0.12 this would be trivially easy with the new Asynchronous Component feature. +Baik, dengan Vue.js kita sudah dapat membangun aplikasi kita sebagai komponen yang dipisahkan. Jika kita dapat dengan malas memuat komponen dinamis hanya ketika itu dibutuhkan, bukankah itu sangat mengesankan? Faktanya, di 0.12 ini akan sangat mudah dengan adanya fitur komponen asinkron yang baru. -In 0.12, you can define a component as a factory function that asynchronously resolves a component definition (can be just a plain options object). Vue.js will only trigger the factory function when the component actually needs to be rendered, and will cache the result for future re-renders: +Di 0.12, Anda dapat mendefinisikan sebuah komponen sebagai you can define a component as a fungsi pabrik yang secara asinkron menyelesaikan definisi komponen (hanya bisa menjadi objek pilihan biasa). Vue.js hanya akan memicu fungsi pabrik ketika komponen tersebut sebenarnya perlu diberikan, dan akan menyimpan hasilnya untuk render selanjutnya: ``` js -Vue.component('async-example', function (resolve, reject) { +Vue.component('contoh-asinkron', function (resolve, reject) { setTimeout(function () { resolve({ - template: '
I am async!
' + template: '
Aku asinkron!
' }) }, 1000) }) ``` -It is up to you to decide how to load the component from the server, e.g. `$.getScript()` or require.js; but the recommended usage is to pair it up with Webpack's [Code Splitting feature](http://webpack.github.io/docs/code-splitting.html): +Terserah Anda untuk memutuskan bagaimana memuat komponen dari server, misalnya menggunakan `$.getScript()` atau require.js; tetapi penggunaan yang disarankan adalah mengunakan Webpack [Fitur Pembatas Kode](http://webpack.github.io/docs/code-splitting.html): ``` js -Vue.component('async-webpack-example', function (resolve, reject) { - // In Webpack AMD like syntax indicates a code split point - require(['./my-async-component'], resolve) +Vue.component('contoh-asinkron-webpack', function (resolve, reject) { + // Di Webpack AMD (Asynchronous Module Definition) seperti sintaks menunjukkan titik perpecahan kode + require(['./komponen-asinkron'], resolve) }) ``` -That's all you need to do. You can use the component just like before, without even thinking about it being async. Webpack will automatically split your final JavaScript into separate bundles with correct dependencies, and automatically load a bundle via Ajax when it is required. You can check out a fully functional example [here](https://github.com/vuejs/vue-webpack-example). +Itu semua hal yang Anda harus lakukan. Anda dapat menggunakan komonen tersebut seperti sebelumnya, tanpa perlu memikirkan tentang asinkron komponen tersebut. Webpack akan secara otomatis memecah kode akhir JavaScript Anda kedalam berkas terpisah dengan keadaan yang benar, dan otomatis memuat berkas melalui Ajax ketika itu dibutuhkan.Anda dapat melihat contoh yang berfungsi penuh [di sini](https://github.com/vuejs/vue-webpack-example). -### Improved Transition System +### Sistem Transisi Yang Lebih Baik -Vue.js' transition system is really easy to use, but in the past it has the limitation that you cannot mix CSS and JavaScript-based transitions together. In 0.12 that is no longer the case! The improved transition system now allows you to add JavaScript hooks to a CSS-based transition for additional control. The amount of hooks exposed have also been expanded to give you finer-grained control at every stage of the transition. + Sistem transisi Vue.js' sangat mudah untuk digunakan, tetapi diakhir itu memiliki batasan bahwa Anda tidak bisa menggabungkan transisi CSS dan berbasis JavaScript bersamaan. Di 0.12 itu bukan lagi masalah! Sistem transisi yang ditingkatkan sekarang memungkinkan Anda menambahkan pengait (hook) JavaScript ke transisi berbasis CSS untuk kontrol tambahan. Jumlah kait (hook) yang terpapar juga telah diperluas untuk memberi Anda kontrol yang lebih halus pada setiap tahap transisi. -`v-repeat` now also ships with built-in support for staggering transitions. It is as simple as adding `stagger="100"` to your repeated element. It is also possible to define separate staggering for enter and leaving, or even dynamically calculate the staggering delay in a JavaScript hook. +`v-repeat` sekarang juga didukung dengan dukungan built-in untuk transisi yang membingungkan. Ini semudah menambahkan `stagger="100"` ke elemen berulang Anda. Hal ini juga memungkinkan untuk menentukan keterpisahan untuk masuk dan keluar, atau bahkan secara dinamis menghitung penundaan yang membingungkan dalam pengait (hook) JavaScript. -For full details on the new transition system, check out the [updated guide](/guide/transitions.html). +Untuk perincian lengkap tentang sistem transisi baru, lihat [panduan terbaru](/guide/transitions.html). -### Performance Tuning +### Penyetelan Kinerja -Vue.js' precise dependency tracking makes it the one of the most efficient view layer for small hot updates, but there's always room for improvement. In 0.12, internal instance creation and compilation refactors have improved first-render performance for large lists by up to 40%. With proper `track-by` usage, [re-rendering with large, brand new dataset](http://vuejs.github.io/js-repaint-perfs/vue/) is also comparable to, or even faster than other Virtual-DOM based frameworks. +Pelacakan ketergantungan tepat Vue.js membuatnya menjadi salah satu lapisan tampilan paling efisien untuk pembaruan kecil, tetapi selalu ada ruang untuk perbaikan. Di 0.12, kreasi instance internal dan refactor kompilasi telah meningkatkan performa render pertama untuk daftar besar hingga 40%. Dengan penggunaan `track-by` yang tepat, [render ulang dengan kumpulan data baru yang besar](http://vuejs.github.io/js-repaint-perfs/vue/) juga sebanding dengan, atau bahkan lebih cepat daripada kerangka kerja berbasis-Virtual-DOM lainnya. -### One More Thing... +### Satu Hal Lagi... -With 0.12 out of the door, more efforts will now be spent on the official vue-router, a dedicated routing library for Vue.js with nested view matching, full transition support, and asynchronous data hooks. I have expressed that Vue.js core intends to stay as a no-frills, drop-in view layer library, and that will not change. The vue-router will be shipped separately and is totally optional, however you can expect it to work seamlessly with Vue.js core when you need it. +Dengan dirilisnya 0.12, lebih banyak upaya sekarang akan dihabiskan pada vue-router resmi, pustaka routing khusus untuk Vue.js dengan menyesuaikan tampilan berlapis, dukungan transisi penuh, dan kait (hook) data asinkron. Saya telah menyatakan bahwa inti Vue.js bermaksud untuk tetap sesuai dengan kebutuhan, pustaka lapisan tampilan drop-in, dan itu tidak akan berubah. Vue-router akan dikirim secara terpisah dan benar-benar opsional, namun Anda dapat mengharapkannya bekerja secara lancar dengan inti Vue.js saat Anda membutuhkannya. diff --git a/src/_posts/1.0.0-release.md b/src/_posts/1.0.0-release.md index 106f2d3f02..482d68d50d 100644 --- a/src/_posts/1.0.0-release.md +++ b/src/_posts/1.0.0-release.md @@ -1,64 +1,64 @@ ---- -title: Vue.js 1.0.0 Released -date: 2015-10-26 10:00:00 ---- - -> Hi HN! If you are not familiar with Vue.js, you might want to read this [blog post](http://blog.evanyou.me/2015/10/25/vuejs-re-introduction/) for a higher level overview. - -After 300+ commits, 8 alphas, 4 betas and 2 release candidates, today I am very proud to announce the release of [Vue.js 1.0.0 Evangelion](https://github.com/vuejs/vue/releases/tag/1.0.0)! Many thanks to all those who participated in the API re-design process - it would not have been possible without all the input from the community. - - - -### Improved Template Syntax - -The 1.0 template syntax resolves a lot of subtle consistency issues and makes Vue templates more concise and more readable in general. The most notable new feature is the shorthand syntax for `v-on` and `v-bind`: - -``` html - - - - - -``` - -When used on a child component, `v-on` listens for custom events and `v-bind` can be used to bind props. The shorthands using child components very succinct: - -``` html - - -``` - -### API Cleanup - -The overall goal for Vue.js 1.0 is to make it suitable for larger projects. This is why there are many API deprecations. Except for ones that are barely used, the most common reason for a deprecation is that the feature leads to patterns that damages maintainability. Specifically, we are deprecating features that make it hard to maintain and refactor a component in isolation without affecting the rest of the project. - -For example, the default asset resolution in 0.12 has implicit fallbacks to parents in the component tree. This makes the assets available to a component non-deterministic and subject how it is used at runtime. In 1.0, all assets are now resolved in strict mode and there are no longer implicit fallbacks to parent. The `inherit` option is also removed, because it too often leads to tightly coupled components that are hard to refactor. - -### Faster Initial Rendering - -1.0 replaces the old `v-repeat` directive with `v-for`. In addition to providing the same functionality and more intuitive scoping, `v-for` provides up to **100%** initial render performance boost when rendering large lists and tables! - -### More Powerful Tooling - -There are also exciting things going on outside of Vue.js core - [vue-loader](https://github.com/vuejs/vue-loader) and [vueify](https://github.com/vuejs/vueify) have received major upgrades including: - -- Hot component reloading. When a `*.vue` component is edited, all of its active instances are hot swapped without reloading the page. This means when making small changes, e.g. tweaking the styles or the template, your app doesn't need to fully reload; the state of the app the swapped component can be preserved, drastically improving the development experience. - -- Scoped CSS. By simply adding a `scoped` attribute to your `*.vue` component style tags, the component's template and final generated CSS are magically re-written to ensure a component's styles are only applied to its own elements. Most importantly, the styles specified in a parent component **does not** leak down to child components nested within it. - -- ES2015 by default. JavaScript is evolving. You can write much cleaner and expressive code using the latest syntax. `vue-loader` and `vueify` now transpiles the JavaScript in your `*.vue` components out of the box, without the need for extra setup. Write future JavaScript today! - -Combined with [vue-router](https://github.com/vuejs/vue-router), Vue.js is now more than a library - it provides a solid foundation for building complex SPAs. - -### What's Next? - -As what 1.0.0 usually suggests, the core API will stay stable for the foreseeable future and the library is ready for production use. Future development will focus on: - -1. Improving `vue-router` and make it production ready. - -2. Streamlining the developer experience, e.g. a better devtool and a CLI for scaffolding Vue.js projects and components. - -3. Providing more learning resources such as tutorials and examples. +--- +title: Vue.js 1.0.0 Released +date: 2015-10-26 10:00:00 +--- + +> Hi HN! Jika kau tidak terbiasa dengan Vue.js, kau mungkin ingin untuk membaca [post blog](http://blog.evanyou.me/2015/10/25/vuejs-re-introduction/) untuk tingkatreview yang lebih tinggi. + +Setelah 300+ commits, 8 alphas, 4 betas dan 2 kandidat perilisan, hari ini saya sangat bangga untuk mengumumkan perilisan dari [Vue.js 1.0.0 Evangelion](https://github.com/vuejs/vue/releases/tag/1.0.0)! Banyak terima kasih untuk semua yang berpatisipasi pada proses design ulang API - hal ini tidak akan mungkin terjadi tanpa semua input dari komunitas. + + + +### Template Syntax yang Lebih Baik + +Template syntax 1.0 memperbaiki banyak isu konsistensi dan membuat template Vue lebih concise dan lebih dapat dibaca pada umumnya. Fitur baru yang paling terlihat adalah syntax singkatan untuk `v-on` dan `v-bind`: + +``` html + + + + + +``` + +Saat digunakan pada komponen child, `v-on` mendengar untuk event buatan sendiri dan `v-bind` dapat digunakan untuk mengikat properti. Penggunaan singkatan pada komponen child sangatlah ketat: + +``` html + + +``` + +### Pembersihan API + +Tujuan keseluruhan dari Vue.js 1.0 adalah untuk membuatnya cocok dengan projek yang lebih besar. Karena itulah banyak pembatalan API. Kecuali untuk API yang jarang digunakan, Alasan paling umum untuk pembatalan API adalah fitur-fiturnya yang menuntun ke pola kerusakan pada proses pemeliharaan. Khususnya, kita membatalkan fitur yang membuat API susah untuk di pelihara dan refactor sebuah komponen isolasi tanpa mempengaruhi isi lain dari proyeknya. + +Sebagai contohnya, Resolusi kegunaan awal pada 0.12 mempunyai reaksi negatif ke parent pada pohon komponen. Hal ini membuat aset-aset dapat digunakan pada komponen yang bersifat tidak deterministik dan bagaimana subjek digunakan saat runtime. Di 1.0, semua aset sekarang diselesaikan pada mode ketat dan sudah tidak ada lagi reaksi negatif ke parent. Opsi `inherit` juga dihapus, karena sering menuntun ke komponen yang berhubungan erat yang susah untuk di refactor. + +### Render Awal Lebih Cepat + +1.0 mengganti `v-repeat` lama searah dengan `v-for`. Sebagai bonus untuk menyediakan fungsi yang sama dan ruang lingkup yang lebih intuitif, `v-for` menyediakan sampai dengan **100%** peningkatan performa render awal saat merender daftar yang besar dan tabel! + +### Alat yang Lebih Kuat + +Ada juga hal-hal menarik yang terjadi di luar Vue.js core - [vue-loader](https://github.com/vuejs/vue-loader) dan [vueify](https://github.com/vuejs/vueify) telah menerima peningkatan utama yang termasuk: + +- Memuat ulang komponen panas. Disaat komponen `*.vue` diedit, semua instansi aktif yang panas bertukar tanpa memuat ulang halaman. Hal ini berarti saat membuat perubahan kecil, atau mengutak-atik style atau template, aplikasimu tidak perlu sepenuhnya dimuat ulang; keadaan komponen aplikasi yang ditukar dapat dipertahankan, meningkatkan pengalaman pengembangan secara drastis. + +- Ruang lingkup CSS. Cukup dengan menambahkan sifat `scoped` ke tag komponen style`*.vue`mu, komponen template dan hasil akhir CSS secara ajaib ditulis ulang untuk memastikan komponen style hanya di terapkan di elemennya sendiri. Yang paling penting, style khusus di komponen parent **tidak** turun ke komponen child yang nested di dalamnya. + +- ES2015 secara settingan awal. JavaScript sedang berevolusi. Kau bisa menulis kode yang lebih rapi dan ekspresif menggunakan syntax terbaru. `vue-loader` dan `vueify` sekarang mentranspile JavaScript di `*.vue` mu, komponen di luar kotak, tanpa dibutuhkannya pengaturan ekstra. Tulislah masa depan JavaScript hari ini! + +Digabung dengan [vue-router](https://github.com/vuejs/vue-router), Vue.js sekarang lebih dari sekadar library - ia menyediakan pondasi kuat untuk membangun SPAs rumit. + +### Apa Selanjutnya? + +Seperti 1.0.0 biasanya menyarankan, inti API akan tetap stabil untuk masa-masa mendatang dan librarynya telah siap untuk penggunaan produksi. Perkembangan kedepan akan fokus pada: + +1. Mengembangkan `vue-router` dan membuatnya siap produksi. + +2. Memperlancar pengalaman developer, misalnya alat pengembangan yang lebih baik dan CLI untuk Perancangan projek dan komponen Vue.js. + +3. Menyediakan lebih banyak sumber pembelajaran seperti tutorial dan contoh-contoh. diff --git a/src/_posts/announcing-2.0.md b/src/_posts/announcing-2.0.md index dbb956155c..d5ee42101c 100644 --- a/src/_posts/announcing-2.0.md +++ b/src/_posts/announcing-2.0.md @@ -3,52 +3,52 @@ title: Announcing Vue.js 2.0 date: 2016-04-27 13:33:00 --- -Today I am thrilled to announce the first public preview of Vue.js 2.0, which brings along many exciting improvements and new features. Let's take a peek at what's in store! +Hari ini saya senang mengumumkan preview publik pertama dari Vue.js 2.0, yang membawa banyak perbaikan menarik dan fitur baru. Mari kita intip apa yang ada di toko! ## Even Leaner, Even Faster -Vue.js has always focused on staying light and fast, but 2.0 pushes it even further. The rendering layer is now based on a lightweight virtual-DOM implementation (based on [Snabbdom](https://github.com/paldepind/snabbdom)) that improves initial rendering speed and memory consumption by up to 2~4x in most scenarios (check out [these benchmarks](https://github.com/vuejs/vue/tree/next/benchmarks)). The template-to-virtual-DOM compiler and the runtime can be separated, so you can pre-compile templates and ship your app with only the runtime, which is less than 12KB min+gzip (as a reference, React 15 is 44KB min+gzip). The compiler also works in the browser, which means you can still drop in one script tag and start hacking, just like before. Even with the compiler included, the build is sitting at 17KB min+gzip, still lighter than the current 1.0 build. +Vue.js selalu fokus untuk tetap ringan dan cepat, tetapi 2.0 mendorongnya lebih jauh. Lapisan rendering sekarang didasarkan pada implementasi DOM virtual-ringan (berdasarkan [Snabbdom] (https://github.com/paldepind/snabbdom)) yang meningkatkan kecepatan rendering awal dan konsumsi memori hingga 2 ~ 4x dalam sebagian besar skenario (lihat [tolak ukur ini] (https://github.com/vuejs/vue/tree/next/benchmark)). Kompiler template-to-virtual-DOM dan runtime dapat dipisahkan, sehingga Anda dapat melakukan pra-kompilasi template dan mengirimkan aplikasi Anda hanya dengan runtime, yang kurang dari 12KB min + gzip (sebagai referensi, Bereaksi 15 adalah 44KB min + gzip). Kompiler juga berfungsi di browser, yang berarti Anda masih dapat memasukkan satu tag skrip dan mulai meretas, seperti sebelumnya. Bahkan dengan kompiler yang disertakan, build berada di 17KB min + gzip, masih lebih ringan dari versi 1.0 saat ini. ## Not Your Average Virtual-DOM -Now, just virtual-DOM sounds boring because there are so many implementations out there - but this one is different. Combined with Vue's reactivity system, it provides optimized re-rendering out of the box without you having to do anything. Each component keeps track of its reactive dependencies during its render, so the system knows precisely when to re-render, and which components to re-render. No need for `shouldComponentUpdate` or immutable data structures - **it just works**. +Sekarang, hanya virtual-DOM yang terdengar membosankan karena ada begitu banyak implementasi di luar sana - tetapi yang ini berbeda. Dikombinasikan dengan sistem reaktivitas Vue, Vue memberikan proses rendering ulang yang dioptimalkan tanpa Anda harus melakukan apa pun. Setiap komponen melacak dependensi reaktif selama render, sehingga sistem tahu persis kapan harus merender ulang, dan komponen mana yang akan dirender ulang. Tidak perlu untuk `shouldComponentUpdate` atau struktur data yang tidak dapat diubah - ** itu hanya berfungsi **. -In addition, Vue 2.0 applies some advanced optimizations during the template-to-virtual-DOM compilation phase: +Selain itu, Vue 2.0 menerapkan beberapa optimasi lanjutan selama fase kompilasi template-to-virtual-DOM: -1. It detects static class names and attributes so that they are never diffed after the initial render. +1. Mendeteksi nama dan atribut kelas statis sehingga tidak pernah berbeda setelah render di awal. -2. It detects the maximum static sub trees (sub trees with no dynamic bindings) and hoist them out of the render function. So on each re-render, it directly reuses the exact same virtual nodes and skips the diffing. +2. Mendeteksi sub trees statis maksimum (sub trees tanpa ikatan dinamis) dan mengeluarkannya dari fungsi render. Jadi pada setiap re-render, secara langsung menggunakan kembali node virtual yang sama persis dan melewatkan diffing. -These advanced optimizations can usually only be achieved via Babel plugins when using JSX, but with Vue 2.0 you can get them even using the in-browser compiler. +Optimalisasi lanjutan ini biasanya hanya dapat dicapai melalui plugin Babel saat menggunakan JSX, tetapi dengan Vue 2.0 Anda bisa mendapatkannya bahkan menggunakan kompiler dalam browser. -The new rendering system also allows you to disable reactive conversions by simply freezing your data and manually force updates, essentially giving you full control over the re-rendering process. +Sistem rendering baru juga memungkinkan Anda untuk menonaktifkan konversi reaktif hanya dengan membekukan data Anda dan secara manual memaksa pembaruan, pada dasarnya memberi Anda kontrol penuh atas proses rendering ulang. -With these techniques combined, Vue 2.0 ensures blazing fast performance in every possible scenario while requiring minimal optimization efforts from the developer. +Dengan teknik-teknik ini digabungkan, Vue 2.0 memastikan kinerja yang sangat cepat dalam setiap skenario yang mungkin sambil memerlukan upaya optimasi minimal dari pengembang. ## Templates, JSX, or Hyperscript? -Developers tend to have strong opinions on templates vs. JSX. On the one hand, templates are closer to HTML - they map better to the semantic structure of your app and make it much easier to think visually about the design, layout and styling. On the other hand, templates are limited to the DSL while the programmatic nature of JSX/hyperscript provides the full expressive power of a turing-complete language. +Pengembang cenderung memiliki pendapat yang kuat tentang template vs JSX. Di satu sisi, templat lebih dekat ke HTML - templat lebih baik pada struktur semantik aplikasi Anda dan membuatnya lebih mudah untuk berpikir secara visual tentang desain, tata letak, dan gaya. Di sisi lain, template terbatas pada DSL sementara sifat program JSX / hyperscript memberikan kekuatan ekspresif penuh dari bahasa turing-complete. -Being a designer/developer hybrid, I prefer writing most of my interfaces in templates, but in certain cases I do miss the flexibility of JSX/hyperscript. An example would be writing a component that programmatically handles its children, something not feasible with just the template-based slot mechanism. +Menjadi hibrida desainer / pengembang, saya lebih suka menulis sebagian besar antarmuka saya di templat, tetapi dalam kasus tertentu saya kehilangan fleksibilitas JSX / hyperscript. Contohnya adalah menulis komponen yang secara terprogram menangani anak-anaknya, sesuatu yang tidak layak hanya dengan mekanisme slot berbasis template. -Well, why not have both? In Vue 2.0, you can keep using the familiar template syntax, or drop down to the virtual-DOM layer whenever you feel constrained by the template DSL. Instead of the `template` option, just replace it with a `render` function. You can even embed render functions in your templates using the special `` tag! The best of both worlds, in the same framework. +Nah, mengapa tidak memiliki keduanya? Dalam Vue 2.0, Anda dapat terus menggunakan sintaks template yang sudah dikenal, atau drop-down ke lapisan virtual-DOM setiap kali Anda merasa terkendala oleh template DSL. Alih-alih opsi `template`, ganti saja dengan fungsi` render`. Anda bahkan dapat menanamkan fungsi render dalam templat Anda menggunakan tag `` khusus! Yang terbaik dari kedua dunia, dalam kerangka yang sama. ## Streaming Server-side Rendering -With the migration to virtual-DOM, Vue 2.0 naturally supports server-side rendering with client-side hydration. One pain point of current mainstream server rendering implementations, such as React's, is that the rendering is synchronous so it can block the server's event loop if the app is complex. Synchronous server-side rendering may even adversely affect time-to-content on the client. Vue 2.0 provides built-in streaming server-side rendering, so that you can render your component, get a readable stream back and directly pipe it to the HTTP response. This ensures your server is responsive, and gets the rendered content to your users faster. +Dengan migrasi ke virtual-DOM, Vue 2.0 secara alami mendukung rendering sisi server dengan hidrasi sisi klien. Salah satu titik sakit dari implementasi render server utama saat ini, seperti React's, adalah renderingnya sinkron sehingga dapat memblokir loop acara server jika aplikasinya kompleks. Render sisi server yang sinkron bahkan dapat mempengaruhi waktu-ke-konten pada klien. Vue 2.0 menyediakan rendering sisi server streaming internal, sehingga Anda dapat merender komponen Anda, mendapatkan aliran yang dapat dibaca kembali dan langsung menyalurkannya ke respons HTTP. Ini memastikan server Anda responsif, dan membuat konten yang diberikan kepada pengguna Anda lebih cepat. ## Unlocking More Possibilities -With the new architecture, there are even more possibilities to explore - for example, rendering to native interfaces on mobile. Currently, we are exploring a port of Vue.js 2.0 that uses [weex](http://alibaba.github.io/weex/) as a native rendering backend, a project maintained by engineers at Alibaba Group, the biggest tech enterprise of China. It is also technically feasible to adapt Vue 2.0's virtual-DOM to run inside ReactNative. We are excited to see how it goes! +Dengan arsitektur baru, bahkan ada lebih banyak kemungkinan untuk dijelajahi - misalnya, rendering ke antarmuka asli di seluler. Saat ini, kami sedang mengeksplorasi port Vue.js 2.0 yang menggunakan [weex] (http://alibaba.github.io/weex/) sebagai backend rendering asli, sebuah proyek yang dikelola oleh para insinyur di Alibaba Group, perusahaan teknologi terbesar dari Cina. Secara teknis juga memungkinkan untuk mengadaptasi virtual-DOM Vue 2.0 untuk dijalankan di dalam ReactNative. Kami sangat senang melihat hasilnya! ## Compatibility and What to Expect Next -Vue.js 2.0 is still in pre-alpha, but you can checkout the source code [here](https://github.com/vuejs/vue/tree/next/). Despite being a full rewrite, the API is largely compatible with 1.0 with the exception of some intentional deprecations. Check out [the same official examples written in 2.0](https://github.com/vuejs/vue/tree/next/examples) - you will see that not much has changed! +Vue.js 2.0 masih dalam pra-alfa, tetapi Anda dapat checkout kode sumber [di sini] (https://github.com/vuejs/vue/tree/next/). Meskipun menjadi penulisan ulang penuh, API sebagian besar kompatibel dengan 1.0 dengan pengecualian beberapa penghentian yang disengaja. Lihat [contoh resmi yang sama yang ditulis dalam 2.0] (https://github.com/vuejs/vue/tree/next/examples) - Anda akan melihat bahwa tidak banyak yang berubah! -The feature deprecations are part of our continued effort to provide the simplest API possible for maximum developer productivity. You can check out a 1.0 vs. 2.0 feature comparison [here](https://github.com/vuejs/vue/wiki/2.0-features). This does mean that it will take some effort to migrate an existing app if you happen to use some of these deprecated features heavily, but we will provide detailed upgrade guides in the future. +Penghentian fitur adalah bagian dari upaya berkelanjutan kami untuk menyediakan API sesederhana mungkin untuk produktivitas pengembang maksimum. Anda dapat memeriksa perbandingan fitur 1.0 vs. 2.0 [di sini] (https://github.com/vuejs/vue/wiki/2.0-features). Ini berarti perlu upaya untuk memigrasikan aplikasi yang ada jika Anda sering menggunakan beberapa fitur yang sudah usang ini, tetapi kami akan memberikan panduan pemutakhiran terperinci di masa mendatang. -There is still much work left to be done. We will be releasing the first alpha once we reach satisfactory test coverage, and we are aiming for beta by end of May / early June. In addition to more tests, we also need to update the supporting libraries (vue-router, Vuex, vue-loader, vueify...). Currently only Vuex works with 2.0 out of the box, but we will make sure that everything works smoothly together when 2.0 ships. +Masih banyak pekerjaan yang harus dilakukan. Kami akan merilis alpha pertama setelah kami mencapai cakupan tes yang memuaskan, dan kami menargetkan beta pada akhir Mei / awal Juni. Selain lebih banyak tes, kami juga perlu memperbarui perpustakaan pendukung (vue-router, Vuex, vue-loader, vueify ...). Saat ini hanya Vuex bekerja dengan 2.0 di luar kotak, tetapi kami akan memastikan bahwa semuanya bekerja dengan lancar saat 2.0 dikirimkan. -We are also not forgetting about 1.x! 1.1 will be released alongside 2.0 beta, with an LTS period of 6-month critical bug fixes and 9-month security updates. It will also ship with optional deprecation warnings to get you prepared for upgrading to 2.0. Stay tuned! +Kami juga tidak melupakan tentang 1.x! 1.1 akan dirilis bersamaan dengan 2.0 beta, dengan periode LTS perbaikan bug kritis 6 bulan dan pembaruan keamanan 9 bulan. Ini juga akan dikirimkan dengan peringatan penghentian opsional untuk membuat Anda siap untuk meningkatkan ke 2.0. Tetap disini! \ No newline at end of file diff --git a/src/_posts/common-gotchas.md b/src/_posts/common-gotchas.md index a8abf2314e..b31bacb225 100644 --- a/src/_posts/common-gotchas.md +++ b/src/_posts/common-gotchas.md @@ -1,38 +1,37 @@ --- -title: Common Beginner Gotchas -date: 2016-02-06 10:00:00 +judul: Rintangan Umum Bagi Pemula +tanggal: 2016-02-06 10:00:00 --- -There are few types of questions that we frequently see from users who are new to Vue.js. Although they are all mentioned somewhere in the guide, they are easy to miss and can be hard to find when you do get bitten by the gotchas. Therefore we are aggregating them in this post and hopefully it can save you some time! - +Ada beragam pertanyaan yang sering dijumpai oleh pengguna yang baru mengenal Vue.js. Sekalipun semua itu telah dijelaskan pada panduan, itu mudah terlewati dan menjadi sulit untuk dicari ketika anda sudah berhadapan dengan rintangan. Oleh karena itu kami mengumpulkan semuanya dalam pembahasan ini dan semoga dapat mempersingkat waktu anda. -### Why isn't the DOM updating? +### Kenapa DOM tidak berubah? -Most of the time, when you change a Vue instance's data, the view updates. But there are two edge cases: +Sebagian besar, ketika anda merubah data pada sebuah Vue instance, tampilan akan diperbaharui. Tetapi ada dua kasus berbeda: -1. When you are **adding a new property** that wasn't present when the data was observed. Due to the limitation of ES5 and to ensure consistent behavior across browsers, Vue.js cannot detect property addition/deletions. The best practice is to always declare properties that need to be reactive upfront. In cases where you absolutely need to add or delete properties at runtime, use the global [`Vue.set`](/api/#Vue-set) or [`Vue.delete`](/api/#Vue-delete) methods. +1. Saat anda **menambahkan properti baru** lalu tidak tersedia ketika data diamati. Disebabkan keterbatasan pada ES5 dan untuk memastikan agar perilaku konsisten disemua browser, Vue.js tidak dapat mendeteksi penambahan/penghapusan properti. Cara terbaik adalah selalu mendeklarasikan properti yang dibutuhkan agar reaktif diawal. Pada beberapa kejadian ketika benar-benar perlu menambah atau menghapus properti saat runtime, gunakan global method [`Vue.set`](/api/#Vue-set) atau [`Vue.delete`](/api/#Vue-delete). -2. When you modify an Array by directly setting an index (e.g. `arr[0] = val`) or modifying its `length` property. Similarly, Vue.js cannot pickup these changes. Always modify arrays by using an Array instance method, or replacing it entirely. Vue provides a convenience method `arr.$set(index, value)` which is syntax sugar for `arr.splice(index, 1, value)`. +2. Saat anda mengubah sebuah Array secara langsung menggunakan sebuah index (contoh `arr[0] = val`) atau mengubah dengan properti `length`. Demikian pula, Vue.js tidak akan melakukan perubahan. Selalu lakukan perubahan array menggunakan Array instance method, atau ganti seluruhnya. Vue menyediakan convenience method `arr.$set(index, value)` yang merupakan syntax sugar dari `arr.splice(index, 1, value)`. -Further reading: [Reactivity in Depth](/guide/reactivity.html) and [Array Change Detection](http://vuejs.org/guide/list.html#Array-Change-Detection). +Baca lebih lanjut: [Reactivity in Depth](/guide/reactivity.html) dan [Array Change Detection](http://vuejs.org/guide/list.html#Array-Change-Detection). -### When is the DOM updated? +### Kapan DOM diperbaharui? -Vue.js uses an asynchronous queue to batch DOM updates. This means when you modify some data, the DOM updates do not happen instantly: they are applied asynchronously when the queue is flushed. So how do you know when the DOM has been updated? Use `Vue.nextTick` right after you modify the data. The callback function you pass to it will be called once the queue has been flushed. +Vue.js menggunakan antrian asinkron untuk mengumpulkan perubahan DOM. Ini berarti saat anda memperbaharui beberapa data, Dom tidak diperbaharui secara langsung: mereka diterapkan secara tidak sinkron ketika antriannya diproses. Jadi, bagaimana anda tahu kapan DOM telah diperbaharui? Gunakan `Vue.nextTick` tepat setelah anda memperbaharui data. Callback function yang diberikan akan dipanggil sekali setelah antrian diproses. -Further reading: [Async Update Queue](/guide/reactivity.html#Async-Update-Queue). +Baca lebih lanjut: [Async Update Queue](/guide/reactivity.html#Async-Update-Queue). -### Why does `data` need to be a function? +### Kenapa `data` harus sebuah function? -In the basic examples, we declare the `data` directly as a plain object. This is because we are creating only a single instance with `new Vue()`. However, when defining a **component**, `data` must be declared as a function that returns the initial data object. Why? Because there will be many instances created using the same definition. If we still use a plain object for `data`, that same object will be **shared by reference** across all instance created! By providing a `data` function, every time a new instance is created we can call it to return a fresh copy of the initial data. +Dalam contoh dasar, kita mendeklarasikan `data` secara langsung sebagai sebuah plain objek. Ini dikarenakan kita hanya membuat sebuah instance tungal dengan `new Vue()`. Namun, ketika mendefinisikan sebuah **komponen**, `data` harus dideklarasikan sebagai sebuah function yang mengembalikan data objek awal. Kenapa? Karena akan banyak instance yang dibuat menggunakan definisi yang sama. Jika kita tetap menggunakan sebuah plain objek untuk `data`, itu objek sama yang akan menjadi **shared by reference** disemua instance yang dibuat! Dengan menyediakan sebuah `data` function, setiap kali sebuah instance baru dibuat kita dapat memanggilnya untuk mengembalikan salinan baru dari data awal. -Further reading: [Component Option Caveats](/guide/components.html#Component-Option-Caveats). +Baca lebih lanjut: [Component Option Caveats](/guide/components.html#Component-Option-Caveats). ### HTML case insensitivity -All Vue.js templates are valid, parsable HTML markup, and Vue.js relies on spec-compliant parsers to process its templates. However, as specified in the standard, HTML is case-insensitive when matching tag and attribute names. This means camelCase attributes like `:myProp="123"` will be matched as `:myprop="123"`. As a rule of thumb, you should use camelCase in JavaScript and kebab-case in templates. For example a prop defined in JavaScript as `myProp` should be bound in templates as `:my-prop`. +Semua templat Vue.js valid, HTML markup dapat diparse, dan Vue.js bergantung pada parser yang memenuhi spesifikasi untuk memproses templatnya. Namun, seperti yang telah ditentukan dalam standar, HTML case-insensitive ketika mencocokan tag dan nama attribut. Ini berarti attribut camelCase seperti `:myProp="123"` akan cocok dengan `:myprop="123"`. Sebagai aturan praktis, anda harus menggunakan camelCase di JavaScript dan kebab-case di templat. Sebagai contoh sebuah prop didefinisikan di JavaScript sebagai `myProp` dan dihubungkan di templat sebagai `:my-prop`. -Further reading: [camelCase vs. kebab-case](http://vuejs.org/guide/components.html#camelCase-vs-kebab-case). +Baca lebih lanjut: [camelCase vs. kebab-case](http://vuejs.org/guide/components.html#camelCase-vs-kebab-case). -We are also discussing the possibility of eliminating this inconsistency by resolving props and components in a case-insensitive manner. Join the conversation [here](https://github.com/vuejs/vue/issues/2308). +Kita juga mendiskusikan kemungkinan menghilangkan ketidakkonsistenan ini dengan memperbaiki props dan komponen dengan cara case-insensitive. Gabung dengan percakapannya [disini](https://github.com/vuejs/vue/issues/2308). diff --git a/src/_posts/march-update.md b/src/_posts/march-update.md index 1a8d0e7bb8..58f1371358 100644 --- a/src/_posts/march-update.md +++ b/src/_posts/march-update.md @@ -1,42 +1,42 @@ --- -title: March 2016 Update -date: 2016-03-14 18:45:00 +judul: Pembaruan Maret 2016 +tanggal: 2016-03-14 18:45:00 --- -## Growing Community +## Komunitas yang Terus Berkembang -Vue's growth in the past year has been nothing short of amazing. As of today we are at over 15,000 stars on GitHub, over 500k downloads from npm, and over 2,000 users in the Gitter channel. What's more exciting though, is that the community successfully organized the first [London Vue.js Meetup](http://www.meetup.com/London-Vue-js-Meetup/) and the first [Paris Vue.js Meetup](http://www.meetup.com/Vuejs-Paris/?scroll=true)! A big shoutout to the awesome organizers: [Jack](https://twitter.com/JackBarham), [James](https://twitter.com/onejamesbrowne/) and [Eduardo](https://twitter.com/posva/). +Pertumbuhan Vue dalam setahun terakhir sangat luar biasa. Sampai hari ini kami memiliki lebih dari 15.000 bintang di GitHub, lebih dari 500 ribu unduhan dari npm, dan lebih dari 2.000 pengguna di saluran Gitter. Yang lebih menarik adalah komunitas berhasil menyelenggarakan [Pertemuan Vue.js London Pertama](http://www.meetup.com/London-Vue-js-Meetup/) dan [Pertemuan Vue.js Paris Pertama](http://www.meetup.com/Vuejs-Paris/?scroll=true)! Sorakan yang menggema untuk penyelenggara yang luar biasa: [Jack](https://twitter.com/JackBarham), [James](https://twitter.com/onejamesbrowne/) dan [Eduardo](https://twitter.com/posva/). - + -If you are interested in connecting with Vue.js users near you and share your experiences in using Vue.js, joining a local Meetup is a great idea - even better, maybe you can organize one :) +Jika kamu tertarik untuk berinteraksi dengan pengguna Vue.js di dekat kamu dan berbagi pengalaman kamu dalam menggunakan Vue.js, bergabung dengan Pertemuan(_Meetup_) lokal adalah ide yang bagus - bahkan lebih baik lagi, mungkin kamu dapat mengadakan/ ikut mengaturnya :) -## Cool Things Being Built +## Karya Keren Yang Dikembangkan Dengan Vue -More and more amazing things are being built with Vue. There are products like [PageKit](https://pagekit.com/), Laravel Spark (coming soon) and [Statamic](https://v2.statamic.com/), sleek apps like [Koel](http://koel.phanan.net/) and [Gokotta](https://github.com/Zhangdroid/Gokotta), UI components like [VueStrap](http://yuche.github.io/vue-strap/) and [Vue-MDL](http://posva.net/vue-mdl/), and smooth, interactive experiences like [YouTube Adblitz](https://adblitz.withyoutube.com) and even the [Facebook NewsFeed Marketing Site](https://newsfeed.fb.com/)! +Semakin banyak karya keren yang dibangun dengan Vue. Ada produk seperti [PageKit](https://pagekit.com/), Laravel Spark (segera hadir) dan [Statamic](https://v2.statamic.com/), aplikasi yang ramping seperti [Koel](http://koel.phanan.net/) dan [Gokotta](https://github.com/Zhangdroid/Gokotta), komponen UI seperti [VueStrap](http://yuche.github.io/vue-strap/) dan [Vue-MDL](http://posva.net/vue-mdl/), dan pengalaman interaktif yang lancar seperti [YouTube Adblitz](https://adblitz.withyoutube.com) dan bahkan [Situs Pemasaran Facebook NewsFeed](https://newsfeed.fb.com/)! -There are many other great projects - too many to be listed here - but you can check them all out in [awesome-vue](https://github.com/vuejs/awesome-vue). If you've built great things with Vue, you should also add them to the list! +Ada banyak proyek keren lainnya - terlalu banyak untuk dicantumkan di sini - tetapi kamu dapat memeriksanya di [awesome-vue](https://github.com/vuejs/awesome-vue). Jika kamu telah membangun hal-hal keren dengan Vue, kamu juga harus menambahkannya ke daftar! -## A New Vision For the Project +## Visi Baru Untuk Proyek Vue -Some of you may have noticed that the development on the Vue.js core repo has slowed down lately - in the meanwhile, a lot of efforts went into other sub projects, namely [Vuex](https://github.com/vuejs/vuex), [vue-devtools](https://github.com/vuejs/vue-devtools) and the official [Webpack project boilerplate](https://github.com/vuejs-templates/webpack). The next step is a new release for [vue-router](https://github.com/vuejs/vue-router), and better documentation/examples demonstrating how Vue.js core, Vuex and vue-router work together in a large single page application. +Beberapa dari kamu mungkin telah memperhatikan bahwa pengembangan repo inti Vue.js telah melambat akhir-akhir ini - sementara itu, banyak upaya dilakukan ke sub proyek lainnya, yaitu [Vuex](https://github.com/vuejs/vuex), [vue-devtools](https://github.com/vuejs/vue-devtools) dan [_boilerplate_(kode yg sering ditulis di berbagai kebutuhan) resmi proyek Webpack](https://github.com/vuejs-templates/webpack). Langkah selanjutnya adalah rilisan baru untuk [vue-router](https://github.com/vuejs/vue-router), dan dokumentasi / contoh yang lebih baik menggambarkan bagaimana inti Vue.js, Vuex dan vue-router bekerja bersama dalam sebuah aplikasi satu-halaman (_single-page app_) besar. -All this adds together towards a new vision for the Vue.js project: a progressive framework that can adapt to different complexity levels. Vue.js core will remain "just the view layer" - you can still drop it on whatever existing page to replace jQuery, but the Vue.js project also includes other pieces like vue-router, Vuex, vue-loader/vueify and vue-cli that works together as a more complete, opinionated framework for single page applications. More on this in a later post. +Semua ini digabungkan untuk mewujudkan visi baru proyek Vue.js: kerangka kerja progresif yang dapat beradaptasi dengan berbagai tingkat kompleksitas. Inti Vue.js akan tetap "hanya lapisan tampilan" - kamu masih dapat meletakannya pada halaman apa pun yang ada untuk menggantikan jQuery, tetapi proyek Vue.js juga mencakup bagian lain seperti vue-router, Vuex, vue-loader / vueify dan vue -cli yang dapat bekerja bersama sebagai kerangka kerja beropini(_opinionated_) yang lebih lengkap untuk aplikasi satu-halaman. Lebih lanjut tentang ini di postingan selanjutnya. -## Vue.js needs your help! +## Vue.js membutuhkan bantuanmu! -Open source is awesome, and I'm proud that Vue.js is helping people build real products all over the world. However, as the scope of the project grows, pushing new features while maintaining everything becomes a very demanding job. The good news is you can help! +Open source itu luar biasa, dan saya bangga bahwa Vue.js ini membantu banyak orang membangun produk nyata di seluruh dunia. Namun, seiring dengan berkembangnya ruang lingkup proyek, menambah fitur baru sambil mempertahankan dan merawat semuanya menjadi pekerjaan yang sangat menuntut. Berita baiknya adalah kamu dapat membantu! -### Looking for collaborators +### Mencari kolaborator -There are already users who frequently helps out in various ways, but this is an invitation to make things official. I'm looking for contributors to join the "team", which is currently mostly just me. If that sounds interesting to you, take a look at the application [here](https://docs.google.com/forms/d/1SgDgKZqyivEf5xl0EOWNfs68Xy3f4oBzLXIlwlS0BIs/viewform). +Sudah ada pengguna yang sering membantu dengan berbagai cara, tetapi ini adalah undangan agar resmi. Saya mencari kontributor untuk bergabung dengan "tim", yang saat ini kebanyakan hanya saya. Jika itu terdengar menarik bagi kamu, lihat formulir lamaran [disini](https://docs.google.com/forms/d/1SgDgKZqyivEf5xl0EOWNfs68Xy3f4oBzLXIlwlS0BIs/viewform). -### Looking for sponsors +### Mencari sponsor -Another way to help making Vue development sustainable is providing direct financial support. The more financial support I receive, the more time I get to spend on making Vue even better. +Cara lain untuk membantu pengembangan Vue terus berlanjut adalah memberikan dukungan langsung berupa pendanaan. Semakin banyak dukungan finansial yang saya terima, semakin banyak waktu yang dapat saya fokuskan untuk membuat Vue menjadi lebih baik. -If you run a business and is using Vue in a revenue-generating product, it would make business sense to sponsor Vue development: it ensures the project that your product relies on stays healthy and actively maintained. It can also help your exposure in the Vue community and makes it easier to attract Vue developers. +Jika kamu menjalankan bisnis dan menggunakan Vue dalam produk yang menghasilkan pendapatan, tentu bijak untuk mensponsori pengembangan Vue: itu memastikan produkmu dapat bergantung pada proyek yang sehat dan dipelihara/dikembangkan secara aktif. Ini juga dapat membangun kehadiran produk kamu di komunitas Vue dan membuatnya lebih mudah untuk menarik pengembang Vue. -If you are an individual user and have enjoyed the productivity of using Vue, consider donating as a sign of appreciation - like buying me coffee once in a while :) +Jika kamu adalah pengguna perorangan dan telah menikmati produktivitas menggunakan Vue, pertimbangkan untuk menyumbang sebagai bentuk penghargaan - seperti membelikan saya kopi sesekali :) -In either case, you can provide recurring funding through Vue's [Patreon campaign](https://www.patreon.com/evanyou), or provide one-time donations via [PayPal](https://www.paypal.me/evanyou). There are many ideas for Vue that I have lined up but haven't had the time to embark on, and I would love to be able to work on them full time - I hope you can help me make that happen! +Dalam kedua kasus tersebut, kamu dapat memberikan pendanaan rutin melalui [kampanye Patreon Vue](https://www.patreon.com/evanyou), atau memberikan sumbangan se-sekali melalui [PayPal](https://www.paypal.me/evanyou). Ada banyak ide untuk Vue yang telah saya wacanakan tetapi belum memiliki waktu untuk memulai, dan saya ingin sekali dapat mengerjakannya penuh waktu - Saya harap kamu dapat membantu saya mewujudkannya! diff --git a/src/coc/index.md b/src/coc/index.md index fd53230a08..cf491f3f1e 100644 --- a/src/coc/index.md +++ b/src/coc/index.md @@ -1,45 +1,44 @@ -# Code Of Conduct +# Kode Etik -## Our Pledge +## Janji Kami -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct. +Demi menumbuhkan sebuah lingkungan yang terbuka dan ramah, Kami selaku kontributor dan pengelola berjanji menjadikan partisipasi dalam proyek dan komunitas kami bebas dari pelecehan bagi semua orang, tanpa memandang usia, ukuran tubuh, disabilitas, etnis, karakteristik seks, identitas dan ekspresi gender, tingkat pengalaman, pendidikan, status ekonomi-sosial, kebangsaan, penampilan pribadi, ras, agama, partai politik, atau identitas dan orientasi seksual. Catatan, akan tetapi bahwa agama, partai politik, atau afiliasi ideologi lainya tidak memberikan pengecualian untuk perilaku yang kami sebutkan sebagai tidak dapat diterima dalam kode etik ini. -## Our Standards +## Patokan Kami -Examples of behavior that contributes to creating a positive environment include: +Beberapa contoh perilaku yang berkontribusi dalam menciptakan lingkungan yang positif meliputi: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +- Menggunakan bahasa yang ramah dan inklusif +- Menghormati berbagai perbedaan sudut pandang dan pengalaman +- Menerima kritik yang membangun dengan baik +- Memusatkan hal terbaik untuk komunitas +- Menunjukan empati terhadap anggota komunitas lainnya -Examples of unacceptable behavior by participants include: +Beberapa contoh perilaku yang tidak dapat diterima oleh para anggota meliputi: -- The use of sexualized language or imagery and unwelcome sexual attention or advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a professional setting +- Penggunaan bahasa atau citra seksual dan tindakan seksual atau lebih yang tidak diinginkan +- Trolling, komentar melecehkan / menghina, dan serangan pribadi atau politik +- Pelecehan secara umum atau pribadi +- Menyebarkan informasi pribadi orang lain, seperti alamat fisik atau elektronik, tanpa izin langsung +- Perilaku lain yang secara wajar dapat dianggap tidak pantas dalam lingkungan profesional -## Our Responsibilities +## Tangung Jawab Kami -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. +Pengelola proyek bertanggung jawab untuk menjelaskan dasar tindakan yang dapat diterima dan diharapkan untuk mengambil tindakan korektif yang tepat dan adil dalam menanggapi setiap tindakan yang tidak dapat diterima. -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. +Pengelola proyek memiliki hak dan kewajiban untuk menghapus, menyunting, atau menolak komentar, komit, kode, suntingan wiki, masalah dan kontribusi lain yang tidak selaras dengan kode etik, atau untuk melarang secara sementara atau permanen kontribusi apapun untuk tindakan-tindakan lain yang dianggap tidak pantas, mengancam, menyinggung atau berbahaya. -## Scope +## Cakupan -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. +Kode etik ini berlaku baik di dalam lingkup proyek atau lingkup publik ketika seorang mewaliki proyek atau komunitasnya. Contoh mewakili sebuah proyek atau komunitas termasuk dalam menggunakan alamat email proyek resmi, menerbitkan melalui akun sosial media resmi, atau bertindak sebagai perwakilan yang ditunjuk di acara baik online ataupun offline. Perwakilan proyek dapat didefinisikan lebih lanjut dan diklarifikasi oleh pengelola proyek. -## Enforcement +## Pelaksanaan -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@vuejs.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Perilaku kasar, melecehkan, atau tindakan lain yang tidak dapat diterima dapat dilaporkan dengan menghubungi tim proyek di community@vue.js.org. Semua keluhan akan ditinjau dan diselidiki dan akan menghasilkan tanggapan yang dianggap perlu dan sesuai dengan keadaan. Tim proyek berkewajiban untuk menjaga rahasia berkenaan dengan pelapor insiden. Rincian lebih lanjut terkait kebijakan pelaksanaan dapat diterbitkan secara terpisah -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. +Pengelola proyek yang tidak mengikuti atau menegakkan kode etik dengan itikad baik dapat menghadapi dampak sementara atau permanen sebagaimana telah ditentukan oleh anggota lain dari kepemimpinan proyek. -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +## Atribusi +Kode etik ini diadaptasi dari the [Contributor Covenant][homepage], versi 1.4, tersedia di https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org diff --git a/src/perf/index.md b/src/perf/index.md index 7a2fdc3d37..0f2e5f5dea 100644 --- a/src/perf/index.md +++ b/src/perf/index.md @@ -1,15 +1,15 @@ --- -title: Performance Comparisons +judul: Perbandingan Kinerja/Performa --- -## TodoMVC Benchmark +## Tolok Ukur(_Benchmark_) TodoMVC -> *Last Updated: 2014-10-12* +> * Terakhir Diperbarui: 2014-10-12 * -Looking for the TodoMVC Benchmark? It's been removed because after discussion with some other framework authors we have agreed that: +Mencari tolok ukur TodoMVC? tolok ukur itu telah dihapus karena setelah diskusi dengan beberapa penulis kerangka kerja lain kami telah sepakat bahwa: -1. The original intention of these benchmarks were for comparing Browser performance rather than that of frameworks. The "synchronously trigger an action xxx times" test routine doesn't reflect meaningful real world user actions. +1. Tujuan sebenarnya dari tolok ukur ini adalah untuk membandingkan kinerja Browser dan bukan kinerja kerangka kerja. Pengujian dengan bentuk "memicu tindakan/aksi tertentu xxx kali" tidak mencerminkan tindakan yang bermakna dari pengguna di dunia nyata. -2. Due to internal implementation differences, frameworks that uses async rendering (e.g. Vue, Om, Mercury) gains the advantage by skipping part of the calculations that happened in the same event loop. The real world user experience doesn't demonstrate such dramatic difference. +2. Karena perbedaan implementasi internal, kerangka kerja yang menggunakan rendering async (contoh. Vue, Om, Mercury) mendapatkan keuntungan dengan melewati sebagian dari perhitungan yang terjadi dalam perulangan peristiwa(_event_) yang sama. Pengalaman pengguna di dunia nyata tidak menunjukkan perbedaan dramatis seperti itu. -3. Overall this benchmark suite gave rise to more controversy than constructive insights, so it's been removed and I'd be happy to replace it with a more meaningful way to measure front-end performance. +3. Secara keseluruhan rangkaian tolok ukur ini memunculkan lebih banyak kontroversi daripada wawasan yang membangun, sehingga lebih baik dihapus dan saya akan senang untuk menggantinya dengan cara yang lebih bermakna untuk mengukur kinerja program bagian depan(_front-end_)/tampilan. diff --git a/src/v2/api/index.md b/src/v2/api/index.md index bf5b600a1b..51353a0140 100644 --- a/src/v2/api/index.md +++ b/src/v2/api/index.md @@ -3,31 +3,31 @@ title: API type: api --- -## Global Config +## Konfigurasi Global -`Vue.config` is an object containing Vue's global configurations. You can modify its properties listed below before bootstrapping your application: +`Vue.config` adalah objek yang berisi konfigurasi global Vue. Anda dapat memodifikasi propertinya yang terdaftar di bawah ini sebelum mem-*bootstrap* aplikasi Anda: ### silent -- **Type:** `boolean` +- **Tipe:** `boolean` -- **Default:** `false` +- **Nilai Anggapan:** `false` -- **Usage:** +- **Penggunaan:** ``` js Vue.config.silent = true ``` - Suppress all Vue logs and warnings. + Memunculkan semua log dan peringatan Vue. ### optionMergeStrategies -- **Type:** `{ [key: string]: Function }` +- **Tipe:** `{ [key: string]: Function }` -- **Default:** `{}` +- **Nilai Anggapan:** `{}` -- **Usage:** +- **Penggunaan:** ``` js Vue.config.optionMergeStrategies._my_option = function (parent, child, vm) { @@ -41,106 +41,106 @@ type: api // Profile.options._my_option = 2 ``` - Define custom merging strategies for options. + Menetapkan strategi penggabungan kustom untuk opsi. - The merge strategy receives the value of that option defined on the parent and child instances as the first and second arguments, respectively. The context Vue instance is passed as the third argument. + Strategi penggabungan menerima nilai dari opsi yang didefinisikan pada *instance* induk dan anak sebagai argumen pertama dan kedua. Konteks dari Vue *instance* dioper sebagai argumen ketiga. -- **See also:** [Custom Option Merging Strategies](../guide/mixins.html#Custom-Option-Merge-Strategies) +- **Lihat juga:** [Strategi Penggabungan pada Opsi Khusus](../guide/mixins.html#Strategi-Penggabungan-pada-Opsi-Khusus) ### devtools -- **Type:** `boolean` +- **Tipe:** `boolean` -- **Default:** `true` (`false` in production builds) +- **Nilai Anggapan:** `true` (`false` pada _build_ produksi) -- **Usage:** +- **Penggunaan:** ``` js - // make sure to set this synchronously immediately after loading Vue + // pastikan untuk mengatur ini secara synchronous segera setelah memuat Vue Vue.config.devtools = true ``` - Configure whether to allow [vue-devtools](https://github.com/vuejs/vue-devtools) inspection. This option's default value is `true` in development builds and `false` in production builds. You can set it to `true` to enable inspection for production builds. + Konfigurasi untuk mengizinkan [vue-devtools](https://github.com/vuejs/vue-devtools) untuk melakukan inspeksi pada aplikasi kita. Nilai anggapan dari opsi ini adalah `true` dalam _build_ pengembangan dan `false` di _build_ produksi. Anda dapat mengaturnya ke `true` untuk mengaktifkan inspeksi pada produksi. ### errorHandler -- **Type:** `Function` +- **Tipe:** `Function` -- **Default:** `undefined` +- **Nilai Anggapan:** `undefined` -- **Usage:** +- **Penggunaan:** ``` js Vue.config.errorHandler = function (err, vm, info) { - // handle error - // `info` is a Vue-specific error info, e.g. which lifecycle hook - // the error was found in. Only available in 2.2.0+ + // penanganan galat + // `info` adalah informasi galat yang spesifik pada Vue, seperti pada kait siklus hidup + // galat ditemukan di. Hanya tersedia di 2.2.0+ } ``` - Assign a handler for uncaught errors during component render function and watchers. The handler gets called with the error and the Vue instance. + Tetapkan _handler_ untuk kesalahan yang tidak tertangkap selama fungsi render komponen dan pengamat _(watcher)_. Fungsi _handler_ akan dipanggil dengan galat dan _instance_ Vue sebagai parameter. - > In 2.2.0+, this hook also captures errors in component lifecycle hooks. Also, when this hook is `undefined`, captured errors will be logged with `console.error` instead of crashing the app. + > Di 2.2.0+, kait ini juga menangkap galat pada kait siklus hidup komponen. Begitu juga ketika kait ini `undefined`, galat tetap akan dicatat dengan `console.error`, alih-alih membuat aplikasi menjadi tidak bisa digunakan. - > In 2.4.0+, this hook also captures errors thrown inside Vue custom event handlers. + > Di 2.4.0+, kait ini juga menangkap galat yang dilempar dari dalam _event handler_ khusus. - > In 2.6.0+, this hook also captures errors thrown inside `v-on` DOM listeners. In addition, if any of the covered hooks or handlers returns a Promise chain (e.g. async functions), the error from that Promise chain will also be handled. + > Di 2.6.0+, kait ini juga menangkap galat yang dilempar dari pemantau _(listener)_ DOM `v-on`. Sebagai tambahan, jika ada kait atau _handler_ yang mengembalikan rantai Promise (misalnya fungsi _async_), maka galat dari rantai Promise tersebut juga akan ditangani. - > Error tracking services [Sentry](https://sentry.io/for/vue/) and [Bugsnag](https://docs.bugsnag.com/platforms/browsers/vue/) provide official integrations using this option. + > Servis pelacak galat [Sentry](https://sentry.io/for/vue/) dan [Bugsnag](https://docs.bugsnag.com/platforms/browsers/vue/) menyediakan integrasi resmi dengan opsi ini. ### warnHandler -> New in 2.4.0+ +> Baru di 2.4.0+ -- **Type:** `Function` +- **Tipe:** `Function` -- **Default:** `undefined` +- **Nilai Anggapan:** `undefined` -- **Usage:** +- **Penggunaan:** ``` js Vue.config.warnHandler = function (msg, vm, trace) { - // `trace` is the component hierarchy trace + // `trace` adalah jejak hierarki komponen } ``` - Assign a custom handler for runtime Vue warnings. Note this only works during development and is ignored in production. + Menetapkan handler khusus untuk peringatan pada *runtime Vue*. Untuk catatan, ini hanya berfungsi selama mode pengembangan dan diabaikan dalam produksi. ### ignoredElements -- **Type:** `Array` +- **Tipe:** `Array` -- **Default:** `[]` +- **Nilai Anggapan:** `[]` -- **Usage:** +- **Penggunaan:** ``` js Vue.config.ignoredElements = [ 'my-custom-web-component', 'another-web-component', - // Use a `RegExp` to ignore all elements that start with "ion-" - // 2.5+ only + // Gunakan `RegExp` untuk mengabaikan semua elemen yang dimulai dengan "ion-" + // hanya 2.5+ /^ion-/ ] ``` - Make Vue ignore custom elements defined outside of Vue (e.g., using the Web Components APIs). Otherwise, it will throw a warning about an `Unknown custom element`, assuming that you forgot to register a global component or misspelled a component name. + Membuat Vue mengabaikan elemen khusus yang didefinisikan di luar Vue (mis., Menggunakan Web Components APIs). Jika tidak, itu akan memunculkan peringatan tentang `Unknown custom element`, dengan asumsi Anda lupa mendaftarkan komponen global atau salah mengeja nama komponen. ### keyCodes -- **Type:** `{ [key: string]: number | Array }` +- **Tipe:** `{ [key: string]: number | Array }` -- **Default:** `{}` +- **Nilai Anggapan:** `{}` -- **Usage:** +- **Penggunaan:** ``` js Vue.config.keyCodes = { v: 86, f1: 112, - // camelCase won`t work + // camelCase tidak akan bekerja mediaPlayPause: 179, - // instead you can use kebab-case with double quotation marks + // tapi gunakan kebab-case dengan tanda kutip ganda "media-play-pause": 179, up: [38, 87] } @@ -150,51 +150,51 @@ type: api ``` - Define custom key alias(es) for `v-on`. + Menetapkan alias key kustom untuk `v-on`. ### performance -> New in 2.2.0+ +> Baru di 2.2.0+ -- **Type:** `boolean` +- **Tipe:** `boolean` -- **Default:** `false (from 2.2.3+)` +- **Nilai Anggapan:** `false (from 2.2.3+)` -- **Usage**: +- **Penggunaan**: - Set this to `true` to enable component init, compile, render and patch performance tracing in the browser devtool performance/timeline panel. Only works in development mode and in browsers that support the [performance.mark](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) API. + Setel ini menjadi `true` untuk mengaktifkan pelacakan inisialisasi komponen, kompilasi, render, dan palacakan performa patch pada alat pengembang peramban di bagian performance/timeline. Hanya berfungsi dalam mode pengembangan dan peramban yang mendukung API [performance.mark](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark). ### productionTip -> New in 2.2.0+ +> Baru di 2.2.0+ -- **Type:** `boolean` +- **Tipe:** `boolean` -- **Default:** `true` +- **Nilai Anggapan:** `true` -- **Usage**: +- **Penggunaan**: - Set this to `false` to prevent the production tip on Vue startup. + Setel ini menjadi `false` untuk mencegah tip produksi pada memulai Vue. -## Global API +## API Global ### Vue.extend( options ) -- **Arguments:** +- **Argumen:** - `{Object} options` -- **Usage:** +- **Penggunaan:** - Create a "subclass" of the base Vue constructor. The argument should be an object containing component options. + Membuat sebuah "subclass" dari konstruktor. Argumen harus berisi objek yang berisi opsi komponen. - The special case to note here is the `data` option - it must be a function when used with `Vue.extend()`. + Kasus spesial untuk dicatat disini adalah opsi `data` - ini harus berupa fungsi ketika digunakan dengan `Vue.extend()`. ``` html
``` ``` js - // create constructor + // buat konstruktor var Profile = Vue.extend({ template: '

{{firstName}} {{lastName}} aka {{alias}}

', data: function () { @@ -205,89 +205,89 @@ type: api } } }) - // create an instance of Profile and mount it on an element + // buat sebuah instance dari profil dan pasang ke dalam elemen new Profile().$mount('#mount-point') ``` - Will result in: + Akan menghasilkan: ``` html

Walter White aka Heisenberg

``` -- **See also:** [Components](../guide/components.html) +- **Lihat juga:** [Components](../guide/components.html) ### Vue.nextTick( [callback, context] ) -- **Arguments:** +- **Argumen:** - `{Function} [callback]` - `{Object} [context]` -- **Usage:** +- **Penggunaan:** - Defer the callback to be executed after the next DOM update cycle. Use it immediately after you've changed some data to wait for the DOM update. + Menangguhkan panggilan balik untuk dieksekusi setelah siklus pembaruan DOM selanjutnya. Gunakan ini segera setelah Anda mengubah beberapa data untuk menunggu untuk pembaruan DOM. ``` js - // modify data + // modifikasi data vm.msg = 'Hello' - // DOM not updated yet + // DOM belum diperbarui Vue.nextTick(function () { - // DOM updated + // DOM telah diperbarui }) - // usage as a promise (2.1.0+, see note below) + // gunakan sebagai promise (2.1.0+, lihat catatan di bawah) Vue.nextTick() .then(function () { - // DOM updated + // DOM telah diperbarui }) ``` - > New in 2.1.0+: returns a Promise if no callback is provided and Promise is supported in the execution environment. Please note that Vue does not come with a Promise polyfill, so if you target browsers that don't support Promises natively (looking at you, IE), you will have to provide a polyfill yourself. + > Baru di 2.1.0+: mengembalikan sebuah _Promise_ jika tidak tersedia panggilan balikdan _Promise_ didukung di lingkungan eksekusi. Tolong catat bahwa Vue tidak datang dengan _Promise_ _polyfill_, jadi jika Anda menargetkan peramban yang tidak mendukung _Promise_ secara bawaan (melihat Anda, IE). Anda harus menyediakan _polyfill_ Anda sendiri. -- **See also:** [Async Update Queue](../guide/reactivity.html#Async-Update-Queue) +- **Lihat juga:** [Async Update Queue](../guide/reactivity.html#Async-Update-Queue) ### Vue.set( target, key, value ) -- **Arguments:** +- **Argumen:** - `{Object | Array} target` - `{string | number} key` - `{any} value` -- **Returns:** the set value. +- **Mengembalikan:** nilai yang diset. -- **Usage:** +- **Penggunaan:** - Adds a property to a reactive object, ensuring the new property is also reactive, so triggers view updates. This must be used to add new properties to reactive objects, as Vue cannot detect normal property additions (e.g. `this.myObject.newProperty = 'hi'`). + Menambahkan properti ke dalam objek reaktif, menjamin properti baru untuk reaktif juga, jadi memicu pembaruan _view_. Ini harus digunakan untuk menambah properti baru untuk objek reaktif, karena Vue tidak dapat mendeteksi penambahan properti normal (sebagai contoh `this.myObject.newProperty = 'hi'`). -

The target object cannot be a Vue instance, or the root data object of a Vue instance.

+

Objek target tidak dapat menjadi _instance_ Vue, atau objek data root dari _instance_ Vue.

-- **See also:** [Reactivity in Depth](../guide/reactivity.html) +- **Lihat juga:** [Reactivity in Depth](../guide/reactivity.html) ### Vue.delete( target, key ) -- **Arguments:** +- **Argumen:** - `{Object | Array} target` - `{string | number} key/index` - > Only in 2.2.0+: Also works with Array + index. + > Hanya di 2.2.0+: Juga bekerja dengan Array + index. -- **Usage:** +- **Penggunaan:** - Delete a property on an object. If the object is reactive, ensure the deletion triggers view updates. This is primarily used to get around the limitation that Vue cannot detect property deletions, but you should rarely need to use it. + Menghapus properti dalam objek. Jika objek reaktif, menjamin pembaruan pemicu penghapusan _view_. Ini terutama digunakan untuk mengatasi batasan dimana Vue tidak dapat mendeteksi penghapusan properti, tapi Anda jarang harus menggunakannya. -

The target object cannot be a Vue instance, or the root data object of a Vue instance.

+

Objek target tidak dapat menjadi _instance_ Vue, atau objek data root dari _instance_ Vue.

-- **See also:** [Reactivity in Depth](../guide/reactivity.html) +- **Lihat juga:** [Reactivity in Depth](../guide/reactivity.html) ### Vue.directive( id, [definition] ) -- **Arguments:** +- **Argumen:** - `{string} id` - `{Function | Object} [definition]` -- **Usage:** +- **Penggunaan:** - Register or retrieve a global directive. + Mendaftarkan atau mengambil directif global. ``` js // register @@ -301,24 +301,24 @@ type: api // register (function directive) Vue.directive('my-directive', function () { - // this will be called as `bind` and `update` + // ini akan dipanggil sebagai `bind` dan `update` }) - // getter, return the directive definition if registered + // getter, mengembalikan definisi direktif jika terdaftar var myDirective = Vue.directive('my-directive') ``` -- **See also:** [Custom Directives](../guide/custom-directive.html) +- **Lihat juga:** [Custom Directives](../guide/custom-directive.html) ### Vue.filter( id, [definition] ) -- **Arguments:** +- **Argumen:** - `{string} id` - `{Function} [definition]` -- **Usage:** +- **Penggunaan:** - Register or retrieve a global filter. + Mendaftarkan atau mengambil filter global. ``` js // register @@ -326,69 +326,69 @@ type: api // return processed value }) - // getter, return the filter if registered + // getter, mengembalikan filter jika terdaftar var myFilter = Vue.filter('my-filter') ``` -- **See also:** [Filters](../guide/filters.html) +- **Lihat juga:** [Filters](../guide/filters.html) ### Vue.component( id, [definition] ) -- **Arguments:** +- **Argumen:** - `{string} id` - `{Function | Object} [definition]` -- **Usage:** +- **Penggunaan:** - Register or retrieve a global component. Registration also automatically sets the component's `name` with the given `id`. + Mendaftarkan atau mengambil komponen global. Pendaftaran juga secara otomatis menset komponen `name` dengan `id` yang diberikan. ``` js - // register an extended constructor + // mendaftarkan sebuah perpanjangan konstruktor Vue.component('my-component', Vue.extend({ /* ... */ })) - // register an options object (automatically call Vue.extend) + // mendaftarkan opsi objek (secara otomatis memanggil Vue.extend) Vue.component('my-component', { /* ... */ }) - // retrieve a registered component (always return constructor) + // mengambil komponen yang telah terdaftar (selalu mengembalikan konstruktor) var MyComponent = Vue.component('my-component') ``` -- **See also:** [Components](../guide/components.html) +- **Lihat juga:** [Components](../guide/components.html) ### Vue.use( plugin ) -- **Arguments:** +- **Argumen:** - `{Object | Function} plugin` -- **Usage:** +- **Penggunaan:** - Install a Vue.js plugin. If the plugin is an Object, it must expose an `install` method. If it is a function itself, it will be treated as the install method. The install method will be called with Vue as the argument. + Memasang plugin Vue.js. Jika plugin adalah sebuah objek, objek tersebut harus membuka metode `install`. Jika ini adalah fungsinya sendiri, ini akan diperlukan sebagai metode pemasangan. Metode pemasangan akan dipanggil dengan Vue sebagai argumen. - This method has to be called before calling `new Vue()` + Metode ini harus dipanggil sebelum memanggil `new Vue()` - When this method is called on the same plugin multiple times, the plugin will be installed only once. + Ketika metode ini dipanggil dalam plugin yang sama beberapa kali, plugin hanya akan dipasang sekali. -- **See also:** [Plugins](../guide/plugins.html) +- **Lihat juga:** [Plugins](../guide/plugins.html) ### Vue.mixin( mixin ) -- **Arguments:** +- **Argumen:** - `{Object} mixin` -- **Usage:** +- **Penggunaan:** - Apply a mixin globally, which affects every Vue instance created afterwards. This can be used by plugin authors to inject custom behavior into components. **Not recommended in application code**. + Menerapkan _mixin_ secara global, akan berpengaruh ke setiap _instance_ Vue yang tercipta setelah itu. Ini dapat digunakan oleh pembuat plugin untuk menginjeksi perilaku khusus ke dalam komponen. **Tidak direkomendasikan dalam kode aplikasi**. -- **See also:** [Global Mixin](../guide/mixins.html#Global-Mixin) +- **Lihat juga:** [Global Mixin](../guide/mixins.html#Global-Mixin) ### Vue.compile( template ) -- **Arguments:** +- **Argumen:** - `{string} template` -- **Usage:** +- **Penggunaan:** - Compiles a template string into a render function. **Only available in the full build.** + Menghimpun untai templat kedalam fungsi render. **Hanya tersedia dalam build penuh.** ``` js var res = Vue.compile('
{{ msg }}
') @@ -402,20 +402,20 @@ type: api }) ``` -- **See also:** [Render Functions](../guide/render-function.html) +- **Lihat juga:** [Render Functions](../guide/render-function.html) ### Vue.observable( object ) -> New in 2.6.0+ +> Baru di 2.6.0+ -- **Arguments:** +- **Argumen:** - `{Object} object` -- **Usage:** +- **Penggunaan:** - Make an object reactive. Internally, Vue uses this on the object returned by the `data` function. + Membuat sebuah reaktif objek. Secara internal, Vue menggunakan ini dalam objek yang dikembalikan oleh fungsi `data`. - The returned object can be used directly inside [render functions](../guide/render-function.html) and [computed properties](../guide/computed.html), and will trigger appropriate updates when mutated. It can also be used as a minimal, cross-component state store for simple scenarios: + Objek yang dikembalikan dapat digunakan secara langsung dalam [fungsi render](../guide/render-function.html) dan [properti computed](../guide/computed.html), dan akan memicu pembaruan yang sesuai ketika bermutasi. Ini juga dapat digunakan secara minimal, menyimpan _state_ lintas komponen untuk skenario sederhana: ``` js const state = Vue.observable({ count: 0 }) @@ -429,15 +429,15 @@ type: api } ``` -

In Vue 2.x, `Vue.observable` directly mutates the object passed to it, so that it is equivalent to the object returned, as [demonstrated here](../guide/instance.html#Data-and-Methods). In Vue 3.x, a reactive proxy will be returned instead, leaving the original object non-reactive if mutated directly. Therefore, for future compatibility, we recommend always working with the object returned by `Vue.observable`, rather than the object originally passed to it.

+

Dalam Vue 2.x, `Vue.observable` secara langsung memutasikan objek yang dioper ke dalamnya, jadi ini sama dengan pengembalian objek, [didemonstrasikan disini](../guide/instance.html#Data-and-Methods). Dalam Vue 3.x, proksi reaktif akan kembali sebagai gantinya, meninggalkan objek nonreaktif aslinya jika bermutasi secara langsung. Karena itu, untuk kompatibilitas di masa yang akan datang, kami selalu merekomendasikan bekerja dengan objek yang dikembalikan oleh `Vue.observable`, dari pada objek asli yang dioper ke dalamnya.

-- **See also:** [Reactivity in Depth](../guide/reactivity.html) +- **Lihat juga:** [Reactivity in Depth](../guide/reactivity.html) ### Vue.version -- **Details**: Provides the installed version of Vue as a string. This is especially useful for community plugins and components, where you might use different strategies for different versions. +- **Detil**: Menyediakan versi yang terpasang dari Vue sebagai untai. Terutama beguna untuk plugin dan komponen dari komunitas, dimana Anda mungkin menggunakan stretegi berbeda untuk versi yang berbeda. -- **Usage**: +- **Penggunaan**: ```js var version = Number(Vue.version.split('.')[0]) @@ -451,41 +451,41 @@ type: api } ``` -## Options / Data +## Opsi / Data ### data -- **Type:** `Object | Function` +- **Tipe:** `Object | Function` -- **Restriction:** Only accepts `Function` when used in a component definition. +- **Batasan:** Hanya menerima `Function` saat digunakan dalam pendefinisian komponen. -- **Details:** +- **Detil:** - The data object for the Vue instance. Vue will recursively convert its properties into getter/setters to make it "reactive". **The object must be plain**: native objects such as browser API objects and prototype properties are ignored. A rule of thumb is that data should just be data - it is not recommended to observe objects with their own stateful behavior. + Objek data pada sebuah Vue *instance*. Vue secara rekursif akan mengkonversi properti-propertinya menjadi *getter/setter* untuk membuatnya *reaktif*. **Objeknya haruslah sederhana**: objek-objek *native* seperti objek *browser* API and properti-properti *prototype* akan diabaikan. Aturan sederhananya adalah data seharusnya hanyalah data - tidak direkomendasikan untuk melakukan observasi ke objek-objek yang memiliki perilaku *stateful* (yang memiliki bermacam variasi keadaan / *state*). - Once observed, you can no longer add reactive properties to the root data object. It is therefore recommended to declare all root-level reactive properties upfront, before creating the instance. + Jika telah terobservasi, kamu tidak dapat lagi menambahkan properti-properti reaktif ke objek data *root*. Maka direkomendasikan untuk mendeklarasikan semua properti-properti reaktif tingkat *root* diawal, sebelum membuat *instance*. - After the instance is created, the original data object can be accessed as `vm.$data`. The Vue instance also proxies all the properties found on the data object, so `vm.a` will be equivalent to `vm.$data.a`. + Setelah *instance* terbuat, objek data original dapat diakses sebagai `vm.$data`. Vue *instance* juga menjembatani semua properti-properti yang ditemui pada objek data, sehingga `vm.a` akan ekuivalen dengan `vm.$data.a`. - Properties that start with `_` or `$` will **not** be proxied on the Vue instance because they may conflict with Vue's internal properties and API methods. You will have to access them as `vm.$data._property`. + Properti-properti yang berawalan `_` atau `$` **tidak** akan dijembatani pada Vue *instance* karena dapat menyebabkan konflik dengan properti-properti internal Vue dan API *methods*. Kamu akan dapat mengakses mereka sebagai `vm.$data._property`. When defining a **component**, `data` must be declared as a function that returns the initial data object, because there will be many instances created using the same definition. If we use a plain object for `data`, that same object will be **shared by reference** across all instances created! By providing a `data` function, every time a new instance is created we can call it to return a fresh copy of the initial data. - If required, a deep clone of the original object can be obtained by passing `vm.$data` through `JSON.parse(JSON.stringify(...))`. + Jika dibutuhkan, penjiplakan mendalam (*deep clone*) daripada objek original dapat dilakukan dengan meneruskan (*passing*) `vm.$data` melalui `JSON.parse(JSON.stringify(...))`. -- **Example:** +- **Contoh:** ``` js var data = { a: 1 } - // direct instance creation + // pembuatan instance secara langsung var vm = new Vue({ data: data }) vm.a // => 1 vm.$data === data // => true - // must use function when in Vue.extend() + // harus menggunakan function saat berada didalam Vue.extend() var Component = Vue.extend({ data: function () { return { a: 1 } @@ -493,45 +493,45 @@ type: api }) ``` - Note that if you use an arrow function with the `data` property, `this` won't be the component's instance, but you can still access the instance as the function's first argument: + Perlu dicatat bahwa jika kamu menggunkan fungsi panah (*arrow function*) pada properti `data`, `this` tidaklah menjadi *instance* dari komponen, namun kamu tetap dapat mengakses *instance* tersebut sebagai argumen pertama dari *function*: ```js data: vm => ({ a: vm.myProp }) ``` -- **See also:** [Reactivity in Depth](../guide/reactivity.html) +- **Lihat juga:** [Reaktivitas Secara Mendalam](../guide/reactivity.html) ### props -- **Type:** `Array | Object` +- **Tipe:** `Array | Object` -- **Details:** +- **Detil:** - A list/hash of attributes that are exposed to accept data from the parent component. It has an Array-based simple syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values. + Sebuah daftar (*list*) / *hash* dari attribut-attribut yang diekspos untuk menerima data dari komponen induk (*parent*). Props memiliki sebuah sintaks sederhana berbasis *Array* dan sintaks alternatif berbasis Objek yang memungkinkan konfigurasi lebih jauh (*advanced*) seperti pengecekan tipe (*type checking*), validasi khusus (*custom*) dan melakukan pemberian nilai-nilai standar (*default values*). - With Object-based syntax, you can use following options: - - **type:** can be one of the following native constructors: `String`, `Number`, `Boolean`, `Array`, `Object`, `Date`, `Function`, `Symbol`, any custom constructor function or an array of those. Will check if a prop has a given type, and will throw a warning if it doesn't. [More information](../guide/components-props.html#Prop-Types) on prop types. + Dengan sintaks berbasis Objek, kamu dapat menggunakan opsi-opsi berikut: + - **type:** dapat berupa salah satu dari *native contructors* berikut: `String`, `Number`, `Boolean`, `Array`, `Object`, `Date`, `Function`, `Symbol`, *constructor* khusus (*custom*) apapun atau suatu *array* dari itu semua. Akan dilakukan pengecekan apakah sebuah *prop* telah diberikan tipe, dan akan memunculkan peringatan jika belum. [Informasi lebih lanjut](../guide/components-props.html#Prop-Types) untuk tipe-tipe *prop*. - **default:** `any` - Specifies a default value for the prop. If the prop is not passed, this value will be used instead. Object or array defaults must be returned from a factory function. + Menspesifikasikan nilai dasar (*default*) untuk *prop*. Jika prop tidak diberikan nilai, maka nilai ini yang akan digunakan. Objek atau *array* standar harus dikembalikan (*returned*) dari *function* yang membuatnya. - **required:** `Boolean` - Defines if the prop is required. In a non-production environment, a console warning will be thrown if this value is truthy and the prop is not passed. + Mendefinisikan jika *prop* ini dibutuhkan (harus ada dan memiliki nilai). Dalam lingkungan yang bukan untuk keperluan produksi (*non-production*), peringatan pada *console* akan dimunculkan jika nilainya *truthy* (`true` atau yang ekuivalen) dan *prop*-nya tidak diteruskan (*passed*). - **validator:** `Function` - Custom validator function that takes the prop value as the sole argument. In a non-production environment, a console warning will be thrown if this function returns a falsy value (i.e. the validation fails). You can read more about prop validation [here](../guide/components-props.html#Prop-Validation). + Sebuah fungsi validator *custom* (bebas dan khusus) yang menerima nilai *prop* sebagai satu-satunya argumen. Dalam lingkungan yang bukan untuk keperluan produksi (*non-production*), peringatan pada *console* akan dimunculkan jika fungsi ini mengembalikan nilai yang *falsy* (`false` atau yang ekuivalen) (misal: validasi gagal). Kamu dapat membaca lebih lanjut tentang validasi *prop* [disini](../guide/components-props.html#Prop-Validation). -- **Example:** +- **Contoh:** ``` js - // simple syntax + // sintaks sederhana Vue.component('props-demo-simple', { props: ['size', 'myMessage'] }) - // object syntax with validation + // sintaks objek dengan validasi Vue.component('props-demo-advanced', { props: { - // type check + // pengecekan tipe height: Number, - // type check plus other validations + // pengecekan tipe plus validasi lain age: { type: Number, default: 0, @@ -544,19 +544,19 @@ type: api }) ``` -- **See also:** [Props](../guide/components-props.html) +- **Lihat juga:** [Props](../guide/components-props.html) ### propsData -- **Type:** `{ [key: string]: any }` +- **Tipe:** `{ [key: string]: any }` -- **Restriction:** only respected in instance creation via `new`. +- **Batasan:** hanya dapat ditemui / digunakan (*respected*) pada pembuatan *instance* via `new`. -- **Details:** +- **Detil:** - Pass props to an instance during its creation. This is primarily intended to make unit testing easier. + Meneruskan *props* ke *instance* saat pembuatan *instance* tersebut. Utamanya ditujukan agar pengerjaan *unit testing* lebih mudah. -- **Example:** +- **Contoh:** ``` js var Comp = Vue.extend({ @@ -573,13 +573,13 @@ type: api ### computed -- **Type:** `{ [key: string]: Function | { get: Function, set: Function } }` +- **Tipe:** `{ [key: string]: Function | { get: Function, set: Function } }` -- **Details:** +- **Detil:** - Computed properties to be mixed into the Vue instance. All getters and setters have their `this` context automatically bound to the Vue instance. + Properti-properti terolah (*computed*) yang kemudian digabung kedalam Vue *instance*. Seluruh *getters* (fungsi untuk mengambil data) dan *setters* (fungsi untuk mengubah data) memiliki konteks `this` yang secara otomatis terikat dengan Vue *instance*-nya. - Note that if you use an arrow function with a computed property, `this` won't be the component's instance, but you can still access the instance as the function's first argument: + Perlu dicatat bahwa jika kamu menggunkan fungsi panah (*arrow function*) pada properti terolah (*computed*), `this` bukanlah *instance* dari komponen, namun kamu tetap dapat mengakses *instance* tersebut sebagai argumen pertama dari *function*: ```js computed: { @@ -587,19 +587,19 @@ type: api } ``` - Computed properties are cached, and only re-computed on reactive dependency changes. Note that if a certain dependency is out of the instance's scope (i.e. not reactive), the computed property will __not__ be updated. + Properti-properti terolah (*computed*) ini akan tersimpan sementara (*cached*), dan hanya akan diolah kembali (*re-computed*) saat ada perubahan pada dependensi reaktif. Perlu dicatat bahwa jika sebuah dependensi tertentu berada diluar cakupan (*scope*) *instance* (misal: tidak reaktif), properti terolah (*computed*) **tidak** akan diperbarui. -- **Example:** +- **Contoh:** ```js var vm = new Vue({ data: { a: 1 }, computed: { - // get only + // hanya get aDouble: function () { return this.a * 2 }, - // both get and set + // get dan set aPlus: { get: function () { return this.a + 1 @@ -616,19 +616,19 @@ type: api vm.aDouble // => 4 ``` -- **See also:** [Computed Properties](../guide/computed.html) +- **Lihat juga:** [Computed Properties](../guide/computed.html) ### methods -- **Type:** `{ [key: string]: Function }` +- **Tipe:** `{ [key: string]: Function }` -- **Details:** +- **Detil:** - Methods to be mixed into the Vue instance. You can access these methods directly on the VM instance, or use them in directive expressions. All methods will have their `this` context automatically bound to the Vue instance. + Metode-metode yang kemudian digabung ke dalam Vue *instance*. Kamu dapat mengakses metode-metode ini secara langsung pada VM *instance*, atau menggunakannya di ekspresi-ekspresi *directive*. Semua metode ini, konteks `this`-nya akan secara otomatis terikat ke Vue *instance*. -

Note that __you should not use an arrow function to define a method__ (e.g. `plus: () => this.a++`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.a` will be undefined.

+

Perlu dicatat bahwa __kamu sebaiknya tidak menggunakan fungsi panah (*arrow*) untuk mendefinisikan sebuah metode__ (contoh: `plus: () => this.a++`). Hal tersebut dikarenakan fungsi panah (*arrow*) mengikat (*bind*) konteks ke konteks induk, menyebabkan `this` bukan lagi Vue *instance* seperti yang kamu ekspektasikan dan `this.a` akan menjadi *undefined*.

-- **Example:** +- **Contoh:** ```js var vm = new Vue({ @@ -643,17 +643,17 @@ type: api vm.a // 2 ``` -- **See also:** [Event Handling](../guide/events.html) +- **Lihat juga:** [Penanganan Event](../guide/events.html) ### watch -- **Type:** `{ [key: string]: string | Function | Object | Array}` +- **Tipe:** `{ [key: string]: string | Function | Object | Array}` -- **Details:** +- **Detil:** - An object where keys are expressions to watch and values are the corresponding callbacks. The value can also be a string of a method name, or an Object that contains additional options. The Vue instance will call `$watch()` for each entry in the object at instantiation. + Sebuah objek dimana *keys* adalah expresi-expresi untuk memantau dan *values* adalah *callback*-nya (fungsi yang dipanggil setelah suatu fungsi lain selesai dieksekusi). *Value* dapat berupa *string* dari nama sebuah metode, atau sebuah Objek yang memiliki opsi-opsi tambahan. Vue *instance* akan memanggil `$watch()` setiap key pada objek saat instansiasi (pembuatan Vue *instance*). -- **Example:** +- **Contoh:** ``` js var vm = new Vue({ @@ -672,14 +672,14 @@ type: api a: function (val, oldVal) { console.log('new: %s, old: %s', val, oldVal) }, - // string method name + // *string* dari nama metode b: 'someMethod', - // deep watcher + // pemantauan mendalam (deep watcher) c: { handler: function (val, oldVal) { /* ... */ }, deep: true }, - // the callback will be called immediately after the start of the observation + // callback akan dipanggil seketika setelah observasi dimulai d: { handler: function (val, oldVal) { /* ... */ }, immediate: true @@ -692,86 +692,86 @@ type: api /* ... */ } ], - // watch vm.e.f's value: {g: 5} + // memantau vm.e.f's value: {g: 5} 'e.f': function (val, oldVal) { /* ... */ } } }) vm.a = 2 // => new: 2, old: 1 ``` -

Note that __you should not use an arrow function to define a watcher__ (e.g. `searchQuery: newValue => this.updateAutocomplete(newValue)`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.updateAutocomplete` will be undefined.

+

Perlu dicatat bahwa __kamu sebaiknya tidak menggunakan fungsi panah (*arrow*) untuk mendefinisikan sebuah watcher__ (contoh: `searchQuery: newValue => this.updateAutocomplete(newValue)`). Hal tersebut dikarenakan fungsi panah (*arrow*) mengikat (*bind*) konteks ke konteks induk, menyebabkan `this` bukan lagi Vue *instance* seperti yang kamu ekspektasikan dan `this.updateAutocomplete` akan menjadi *undefined*.

-- **See also:** [Instance Methods / Data - vm.$watch](#vm-watch) +- **Lihat juga:** [Metode Instance / Data - vm.$watch](#vm-watch) -## Options / DOM +## Opsi / DOM ### el -- **Type:** `string | Element` +- **Tipe:** `string | Element` -- **Restriction:** only respected in instance creation via `new`. +- **Batasan:** hanya berlaku pada pembuatan _instance_ melalui `new`. -- **Details:** +- **Detil:** - Provide the Vue instance an existing DOM element to mount on. It can be a CSS selector string or an actual HTMLElement. + Berikan _instance_ Vue sebuah elemen DOM yang sudah ada untuk dipasangkan. Ini bisa berupa kata pemilih CSS atau sebuah HTMLElement sesungguhnya. - After the instance is mounted, the resolved element will be accessible as `vm.$el`. + Setelah _instance_ sudah dipasangkan, elemen akan dapat diakses sebagai `vm.$el`. - If this option is available at instantiation, the instance will immediately enter compilation; otherwise, the user will have to explicitly call `vm.$mount()` to manually start the compilation. + Jika opsi ini ada saat pembuatan _instance_, _instance_ akan langsung menjalankan kompilasi; jika tidak, pengguna harus memanggil `vm.$mount()` secara eksplisit untuk menjalankan kompilasi secara manual. -

The provided element merely serves as a mounting point. Unlike in Vue 1.x, the mounted element will be replaced with Vue-generated DOM in all cases. It is therefore not recommended to mount the root instance to `` or ``.

+

Elemen yang diberikan hanya menjadi titik pemasangan. Tidak seperti Vue 1.x, elemen yang dipasangkan akan digantikan dengan DOM yang dihasilkan oleh Vue dalam semua kasus. Karena itu tidak disarankan untuk memasangkan instance akar ke `` atau ``.

-

If neither `render` function nor `template` option is present, the in-DOM HTML of the mounting DOM element will be extracted as the template. In this case, Runtime + Compiler build of Vue should be used.

+

Jika fungsi `render` maupun opsi `template` tidak diberikan, DOM HTML yang di dalam dari elemen DOM yang dipasangkan akan diekstrak sebagai template. Dalam kasus ini, Runtime + Compiler build Vue harus digunakan.

-- **See also:** +- **Lihat juga:** - [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram) - [Runtime + Compiler vs. Runtime-only](../guide/installation.html#Runtime-Compiler-vs-Runtime-only) ### template -- **Type:** `string` +- **Tipe:** `string` -- **Details:** +- **Detil:** - A string template to be used as the markup for the Vue instance. The template will **replace** the mounted element. Any existing markup inside the mounted element will be ignored, unless content distribution slots are present in the template. + Templat string yang akan digunakan sebagai markup untuk _instance_ Vue. Template akan **menggantikan** elemen yang dipasang. Markup apa pun yang ada di dalam elemen yang dipasang akan diabaikan, kecuali jika slot distribusi konten ada dalam template. - If the string starts with `#` it will be used as a querySelector and use the selected element's innerHTML as the template string. This allows the use of the common ` {% endraw %} - Using `$emit` with additional arguments: + Menggunakan `$emit` dengan argumen tambahan: ```js - Vue.component('magic-eight-ball', { + Vue.component('pemberi-saran', { data: function () { return { - possibleAdvice: ['Yes', 'No', 'Maybe'] + opsiSaran: ['Ya', 'Tidak', 'Mungkin'] } }, methods: { - giveAdvice: function () { - var randomAdviceIndex = Math.floor(Math.random() * this.possibleAdvice.length) - this.$emit('give-advice', this.possibleAdvice[randomAdviceIndex]) + beriSaran: function () { + var indeksSaranAcak = Math.floor(Math.random() * this.opsiSaran.length) + this.$emit('beri-saran', this.opsiSaran[indeksSaranAcak]) } }, template: ` - ` }) @@ -1733,7 +1734,7 @@ type: api ```html
- +
``` @@ -1741,8 +1742,8 @@ type: api new Vue({ el: '#emit-example-argument', methods: { - showAdvice: function (advice) { - alert(advice) + tampilkanSaran: function (saran) { + alert(saran) } } }) @@ -1750,96 +1751,96 @@ type: api {% raw %}
- +
{% endraw %} -## Instance Methods / Lifecycle +## Metode Instance / Siklus Hidup ### vm.$mount( [elementOrSelector] ) -- **Arguments:** +- **Argumen:** - `{Element | string} [elementOrSelector]` - `{boolean} [hydrating]` -- **Returns:** `vm` - the instance itself +- **Mengembalikan:** `vm` - instansiasi dari dirinya sendiri -- **Usage:** +- **Penggunaan:** - If a Vue instance didn't receive the `el` option at instantiation, it will be in "unmounted" state, without an associated DOM element. `vm.$mount()` can be used to manually start the mounting of an unmounted Vue instance. + Jika *instance* vue tidak mencantumkan opsi `el` saat instansiasi, maka *instance* tersebut akan masuk kedalam keadaan "tidak terpasang/*unmounted*", tanpa terasosiasi dengan elemen *DOM* manapun. `vm.$mount()` dapat digunakan untuk menjalankan proses pemasangan/*mount* secara manual dari sebuah *instance* vue yang tak terpasang sebelumnya. - If `elementOrSelector` argument is not provided, the template will be rendered as an off-document element, and you will have to use native DOM API to insert it into the document yourself. + Jika argumen `elementOrSelector` tidak disediakan, maka templat akan di*render* sebagai dokumen mati atau *off-document element*, dan anda dapat menggunakan *native DOM API* untuk memasukannya elemen kedalam dokumen anda. - The method returns the instance itself so you can chain other instance methods after it. + *method* ini akan mengembalikan *instance*nya sendiri, oleh sebab itu anda dapat mengaitkannya ke method-method yang lain setelah pemanggilannya. -- **Example:** +- **Contoh:** ``` js var MyComponent = Vue.extend({ template: '
Hello!
' }) - // create and mount to #app (will replace #app) + // instansiasi dan pemasangan kedalam elemen #app (akan menggantikan #app) new MyComponent().$mount('#app') - // the above is the same as: + // kode diatas serupa dengan ini: new MyComponent({ el: '#app' }) - // or, render off-document and append afterwards: + // atau, me*render* dokumen mati dan menambahkan setelahnya: var component = new MyComponent().$mount() document.getElementById('app').appendChild(component.$el) ``` -- **See also:** - - [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram) - - [Server-Side Rendering](../guide/ssr.html) +- **Lihat juga:** + - [Siklus Hidup Diagram](../guide/instance.html#Lifecycle-Diagram) + - [Proses Render Pada Sisi Server](../guide/ssr.html) ### vm.$forceUpdate() -- **Usage:** +- **Penggunaan:** - Force the Vue instance to re-render. Note it does not affect all child components, only the instance itself and child components with inserted slot content. + Memaksa *instance* Vue untuk melakukan proses *render* ulang. Catatan hal ini tidak akan berpengaruh kepada semua anak dari komponen, hanya berpengaruh pada *instance*nya sendiri dan anak komponen yang disertai sisipan konten *slot*. ### vm.$nextTick( [callback] ) -- **Arguments:** +- **Argumen:** - `{Function} [callback]` -- **Usage:** +- **Penggunaan:** - Defer the callback to be executed after the next DOM update cycle. Use it immediately after you've changed some data to wait for the DOM update. This is the same as the global `Vue.nextTick`, except that the callback's `this` context is automatically bound to the instance calling this method. + Menunda eksekusi dari *callback* setelah siklus pembaharuan DOM berikutnya. Gunakan method ini sesegera mungkin setelah anda melakukan perubahan data untuk menunggu pembaharuan *DOM*. Ini sama halnya dengan global `Vue.nextTick`, kecuali dalam konteks `this` pada *callback* yang akan otomatis tertuju kepada *instance* vue pemanggil. - > New in 2.1.0+: returns a Promise if no callback is provided and Promise is supported in the execution environment. Please note that Vue does not come with a Promise polyfill, so if you target browsers that don't support Promises natively (looking at you, IE), you will have to provide a polyfill yourself. + > Baru di 2.1.0+: mengembalikan *Promise* jika tidak disediakan *callback* dan *Promise* ini telah mendukung eksekusi lingkungan/*environtment*. Mohon dicatat *promise* yang disediakan oleh *Vue* tidak menyertakan *polyfill*, oleh sebab itu jika target browser anda tidak mendukung *promise* (seperti IE), anda sendiri yang memiliki kewajiban untuk menyediakannya. -- **Example:** +- **Contoh:** ``` js new Vue({ @@ -1847,12 +1848,12 @@ type: api methods: { // ... example: function () { - // modify data + // mengubah data this.message = 'changed' - // DOM is not updated yet + // DOM belum diperbaharui this.$nextTick(function () { - // DOM is now updated - // `this` is bound to the current instance + // DOM telah diperbaharui + // `this` tertuju pada yang menginstansiasi this.doSomethingElse() }) } @@ -1860,97 +1861,97 @@ type: api }) ``` -- **See also:** +- **Lihat juga:** - [Vue.nextTick](#Vue-nextTick) - - [Async Update Queue](../guide/reactivity.html#Async-Update-Queue) + - [Pembaharuan Antrian Async](../guide/reactivity.html#Async-Update-Queue) ### vm.$destroy() -- **Usage:** +- **Kegunaan:** - Completely destroy a vm. Clean up its connections with other existing vms, unbind all its directives, turn off all event listeners. + Menuntaskan pemusnahan sebuah vm. Membersihkan koneksi-koneksi terhadap vm-vm aktif yang lain, melepaskan keterikatan terhadap semua direktifnya, dan menonaktifkan semua *event listener*nya. - Triggers the `beforeDestroy` and `destroyed` hooks. + Memicu `beforeDestroy` dan `destroyed` *hooks*. -

In normal use cases you shouldn't have to call this method yourself. Prefer controlling the lifecycle of child components in a data-driven fashion using `v-if` and `v-for`.

+

Dalam situasi normal anda diharapkan tidak menggunakan method ini. Dalam pengontrolan siklus hidup komponen anak pada *data-driven*, Lebih disarankan untuk menggunakan `v-if` and `v-for`.

-- **See also:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram) +- **Lihat juga:** [Siklus Hidup Diagram](../guide/instance.html#Lifecycle-Diagram) -## Directives +## Direktif ### v-text -- **Expects:** `string` +- **Nilai Anggapan:** `string` -- **Details:** +- **Rincian:** - Updates the element's `textContent`. If you need to update the part of `textContent`, you should use `{% raw %}{{ Mustache }}{% endraw %}` interpolations. + Mengubah `textContent` dari elemen. Jika Anda perlu mengubah bagian `textContent`, Anda harus menggunakan interpolasi `{% raw %}{{ Mustache }}{% endraw %}`. -- **Example:** +- **Contoh:** ```html - + {{msg}} ``` -- **See also:** [Data Binding Syntax - Interpolations](../guide/syntax.html#Text) +- **Lihat juga:** [Sintaksis Data Binding - Interpolasi](../guide/syntax.html#Text) ### v-html -- **Expects:** `string` +- **Nilai Anggapan:** `string` -- **Details:** +- **Rincian:** - Updates the element's `innerHTML`. **Note that the contents are inserted as plain HTML - they will not be compiled as Vue templates**. If you find yourself trying to compose templates using `v-html`, try to rethink the solution by using components instead. + Mengubah `innerHTML` dari elemen. **Catat bahwa konten disisipkan sebagai HTML biasa - mereka tidak akan dikompilasi sebagai templat Vue**. Jika anda mencoba membuat templat menggunakan `v-html`, sebaiknya anda memikirkian ulang solusinya dengan menggunakan komponen. -

Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use `v-html` on trusted content and **never** on user-provided content.

+

Me-render sembarang HTML secara dinamis pada website anda bisa sangat berbahaya karena bisa dengan mudah mendapatkan [serangan XSS](https://en.wikipedia.org/wiki/Cross-site_scripting). Gunakan `v-html` hanya pada konten yang dapat dipercaya dan **jangan pernah** pada konten yang disediakan pengguna.

-

In [single-file components](../guide/single-file-components.html), `scoped` styles will not apply to content inside `v-html`, because that HTML is not processed by Vue's template compiler. If you want to target `v-html` content with scoped CSS, you can instead use [CSS modules](https://vue-loader.vuejs.org/en/features/css-modules.html) or an additional, global ` ``` -The optional `scoped` attribute automatically scopes this CSS to your component by adding a unique attribute (such as `data-v-21e5b78`) to elements and compiling `.list-container:hover` to something like `.list-container[data-v-21e5b78]:hover`. +Atribut `scoped` yang bersifat opsional secara otomatis menggabungkan CSS kedalam komponen Anda (hanya di komponen ini saja) dengan cara menambahkan atribut yang unik (seperti `data-v-21e5b78`) dan di-*compile* dari `.list-container:hover` menjadi seperti `.list-container[data-v-21e5b78]:hover`. -Lastly, the styling in Vue's single-file component's is very flexible. Through [vue-loader](https://github.com/vuejs/vue-loader), you can use any preprocessor, post-processor, and even deep integration with [CSS Modules](https://vue-loader.vuejs.org/en/features/css-modules.html) -- all within the ` {% endraw %} -You'll notice that if you select a post, switch to the _Archive_ tab, then switch back to _Posts_, it's no longer showing the post you selected. That's because each time you switch to a new tab, Vue creates a new instance of the `currentTabComponent`. +Jika Anda memilih salah satu postingan di tab _Posts_, kemudian pindah ke tab _Archive_, kemudian pindah lagi ke tab _Posts_, Anda akan melihat bahwa tab _Posts_ tidak lagi menampilkan postingan yang Anda pilih sebelumnya. Itu karena setiap kali Anda berpindah ke tab baru, Vue akan membuat *Instance* baru dari `currentTabComponent`. -Recreating dynamic components is normally useful behavior, but in this case, we'd really like those tab component instances to be cached once they're created for the first time. To solve this problem, we can wrap our dynamic component with a `` element: +Membuat kembali komponen yang dinamis merupakan tindakan yang bermanfaat, tapi dalam kasus ini, kami ingin sekali *Instance* komponen tab di-*cache* setelah dibuat pertama kali. Untuk mengatasi masalah ini, Kami akan membungkus komponen dinamis kami dengan elemen ``: ``` html - + ``` -Check out the result below: +Lihat hasilnya di bawah ini: {% raw %}

@@ -193,20 +193,20 @@ new Vue({ {% endraw %} -Now the _Posts_ tab maintains its state (the selected post) even when it's not rendered. See [this fiddle](https://jsfiddle.net/chrisvfritz/Lp20op9o/) for the complete code. +Sekarang tab _Posts_ bisa mempertahankan *state*nya (postingan yang telah dipilih) bahkan saat tidak di-*render*. Lihat di [fiddle](https://jsfiddle.net/chrisvfritz/Lp20op9o/) untuk kode lengkapnya. -

Note that `` requires the components being switched between to all have names, either using the `name` option on a component, or through local/global registration.

+

Perhatikan bahwa `` membutuhkan nama untuk semua komponen yang akan dipindahkan, baik menggunakan opsi `name` pada komponen, atau menggunakan nama dari komponen yang telah didaftarkan secara lokal/global.

-Check out more details on `` in the [API reference](../api/#keep-alive). +Lihat detail selengkapnya tentang `` di [API reference](../api/#keep-alive). -## Async Components +## Komponen Async -In large applications, we may need to divide the app into smaller chunks and only load a component from the server when it's needed. To make that easier, Vue allows you to define your component as a factory function that asynchronously resolves your component definition. Vue will only trigger the factory function when the component needs to be rendered and will cache the result for future re-renders. For example: +Di sebuah aplikasi yang besar, mungkin kami perlu membagi aplikasi kami menjadi beberapa bagian kecil, dan hanya memuat komponen dari server saat kami membutuhkannya. Untuk membuatnya lebih mudah, Vue memungkinkan Anda untuk mendefinisikan komponen Anda sebagai *factory function* yang secara asinkron menyelesaikan pendefinisian komponen Anda. Vue hanya akan memicu *factory function* saat komponen perlu di-*render* dan akan di-*cache* hasilnya untuk di-*render* kembali di masa mendatang. Misalnya: ``` js Vue.component('async-example', function (resolve, reject) { setTimeout(function () { - // Pass the component definition to the resolve callback + // Lewati pendefinisian komponen ke *resolve callback* resolve({ template: '
I am async!
' }) @@ -214,28 +214,28 @@ Vue.component('async-example', function (resolve, reject) { }) ``` -As you can see, the factory function receives a `resolve` callback, which should be called when you have retrieved your component definition from the server. You can also call `reject(reason)` to indicate the load has failed. The `setTimeout` here is for demonstration; how to retrieve the component is up to you. One recommended approach is to use async components together with [Webpack's code-splitting feature](https://webpack.js.org/guides/code-splitting/): +Seperti yang Anda lihat, *factory function* akan menerima `resolve` *callback*, yang harus dipanggil saat Anda telah mengambil definisi komponen Anda dari server. Anda juga bisa memanggil `reject(reason)` untuk menunjukkan bahwa pemuatan komponen Anda telah gagal. `setTimeout` di sini hanya untuk demonstrasi; bagaimana cara mengambil komponen, itu terserah Anda. Salah satu opsi yang kami sarankan adalah menggunakan komponen *async* dengan [Fitur *code-splitting* Webpack](https://webpack.js.org/guides/code-splitting/): ``` js Vue.component('async-webpack-example', function (resolve) { - // This special require syntax will instruct Webpack to - // automatically split your built code into bundles which - // are loaded over Ajax requests. + // Sintaks khusus ini akan memberikan instruksi ke webpack untuk + // membagi kode *built* Anda menjadi *bundles* secara otomatis + // yang akan di muat oleh *Ajax requests*. require(['./my-async-component'], resolve) }) ``` -You can also return a `Promise` in the factory function, so with Webpack 2 and ES2015 syntax you can do: +Anda juga bisa mengembalikan `Promise` di *factory function*, jadi dengan sintaks Webpack 2 dan ES2015 yang bisa Anda lakukan adalah: ``` js Vue.component( 'async-webpack-example', - // The `import` function returns a Promise. + // *function* `import` akan mengembalikan *Promise*. () => import('./my-async-component') ) ``` -When using [local registration](components-registration.html#Local-Registration), you can also directly provide a function that returns a `Promise`: +Saat menggunakan [pendaftaran lokal](components-registration.html#Local-Registration), Anda juga bisa langsung menyediakan *function* yang akan mengembalikan `Promise`: ``` js new Vue({ @@ -246,28 +246,28 @@ new Vue({ }) ``` -

If you're a Browserify user that would like to use async components, its creator has unfortunately [made it clear](https://github.com/substack/node-browserify/issues/58#issuecomment-21978224) that async loading "is not something that Browserify will ever support." Officially, at least. The Browserify community has found [some workarounds](https://github.com/vuejs/vuejs.org/issues/620), which may be helpful for existing and complex applications. For all other scenarios, we recommend using Webpack for built-in, first-class async support.

+

Jika Anda pengguna Browserify yang ingin menggunakan komponen *async*, sayangnya pembuat Browserify [telah menjelaskan](https://github.com/substack/node-browserify/issues/58#issuecomment-21978224) secara resmi bahwa memuat *async* di Browserify itu tidak didukung. Komunitas Browserify telah menemukan [beberapa solusi](https://github.com/vuejs/vuejs.org/issues/620) yang mungkin bermanfaat untuk aplikasi yang sudah ada dan kompleks. Untuk semua skenario lainnya, kami sarankan untuk menggunakan webpack untuk sistem *build* yang mendukung *async*.

-### Handling Loading State +### Menangani Pemuatan State -> New in 2.3.0+ +> Baru di versi 2.3.0+ -The async component factory can also return an object of the following format: +*Async component factory* juga bisa mengembalikan objek dengan menggunakan format berikut: ``` js const AsyncComponent = () => ({ - // The component to load (should be a Promise) + // Komponen yang dimuat (harus *Promise*) component: import('./MyComponent.vue'), - // A component to use while the async component is loading + // Komponen yang akan di gunakan saat komponen *async* sedang dimuat loading: LoadingComponent, - // A component to use if the load fails + // Komponen yang digunakan jika memuat gagal error: ErrorComponent, - // Delay before showing the loading component. Default: 200ms. + // Jeda sebelum menampikan komponen yang sedang dimuat. Default: 200ms. delay: 200, - // The error component will be displayed if a timeout is - // provided and exceeded. Default: Infinity. + // Komponen *error* akan ditampilkan jika batas waktu + // yang disediakan telah dilampaui. Default: Infinity. timeout: 3000 }) ``` -> Note that you must use [Vue Router](https://github.com/vuejs/vue-router) 2.4.0+ if you wish to use the above syntax for route components. +> Perhatikan bahwa Anda harus menggunakan [Vue Router](https://github.com/vuejs/vue-router) 2.4.0+ jika Anda ingin menggunakan sintaks di atas untuk *route* komponen. diff --git a/src/v2/guide/components-edge-cases.md b/src/v2/guide/components-edge-cases.md index c8a6a49eae..b8641ac00e 100644 --- a/src/v2/guide/components-edge-cases.md +++ b/src/v2/guide/components-edge-cases.md @@ -1,23 +1,24 @@ --- -title: Handling Edge Cases +title: Menangani Kasus Langka type: guide order: 106 --- -> This page assumes you've already read the [Components Basics](components.html). Read that first if you are new to components. +> Halaman ini menganggap Anda sudah membaca [Dasar Komponen](components.html). Baca dulu jika Anda baru mengenal komponen. -

All the features on this page document the handling of edge cases, meaning unusual situations that sometimes require bending Vue's rules a little. Note however, that they all have disadvantages or situations where they could be dangerous. These are noted in each case, so keep them in mind when deciding to use each feature.

+

Semua fitur pada halaman ini mendokumentasikan penanganan kasus langka, berarti situasi yang tidak biasa yang kadang-kadang membutuhkan sedikit mengubah aturan Vue. Namun perhatikan, bahwa semua fitur memiliki kelemahan atau situasi di mana mereka bisa berbahaya. Semua itu dicatat dalam setiap kasus, jadi ingatlah ketika memutuskan untuk menggunakan setiap fitur.

-## Element & Component Access -In most cases, it's best to avoid reaching into other component instances or manually manipulating DOM elements. There are cases, however, when it can be appropriate. +## Akses Elemen & Komponen -### Accessing the Root Instance +Dalam kebanyakan kasus, yang terbaik adalah menghindari menjangkau ke instance komponen lainnya atau memanipulasi elemen DOM secara manual. Namun, ada kasus-kasus di mana itu harus dilakukan. -In every subcomponent of a `new Vue` instance, this root instance can be accessed with the `$root` property. For example, in this root instance: +### Mengakses Instance Root + +Dalam setiap subkomponen dari *instance* `new Vue`, *instance* *root* ini dapat diakses dengan properti `$root`. Misalnya, dalam *instance* *root* ini: ```js -// The root Vue instance +// Contoh root Vue new Vue({ data: { foo: 1 @@ -31,31 +32,31 @@ new Vue({ }) ``` -All subcomponents will now be able to access this instance and use it as a global store: +Semua subkomponen sekarang dapat mengakses instance ini dan menggunakannya sebagai *store* global: ```js -// Get root data +// Mendapatkan data root this.$root.foo -// Set root data +// Menetapkan data root this.$root.foo = 2 -// Access root computed properties +// Akses root computed properties this.$root.bar -// Call root methods +// Memanggil root methods this.$root.baz() ``` -

This can be convenient for demos or very small apps with a handful of components. However, the pattern does not scale well to medium or large-scale applications, so we strongly recommend using Vuex to manage state in most cases.

+

Ini dapat memudahkan untuk demo atau aplikasi yang sangat kecil dengan beberapa komponen. Namun cara ini tidak berskala dengan baik ke aplikasi skala menengah atau besar, jadi kami sangat menyarankan menggunakan Vuex Untuk mengelola state pada umumnya.

-### Accessing the Parent Component Instance +### Mengakses *instance* induk komponen -Similar to `$root`, the `$parent` property can be used to access the parent instance from a child. This can be tempting to reach for as a lazy alternative to passing data with a prop. +Mirip dengan `$root`, properti `$parent` dapat digunakan untuk mengakses *instance* induk dari anak. Sebagai alternatif untuk yang malas mengoper data dengan props. -

In most cases, reaching into the parent makes your application more difficult to debug and understand, especially if you mutate data in the parent. When looking at that component later, it will be very difficult to figure out where that mutation came from.

+

Dalam kebanyakan kasus, menjangkau komponen induk membuat aplikasi Anda lebih sulit untuk di-debug dan dipahami, terlebih jika Anda mutasi data dalam induk. Saat melihat komponen itu nanti, akan sangat sulit untuk mencari tahu dari mana asal mutasi itu.

-There are cases however, particularly shared component libraries, when this _might_ be appropriate. For example, in abstract components that interact with JavaScript APIs instead of rendering HTML, like these hypothetical Google Maps components: +Namun ada beberapa kasus, khususnya pustaka komponen yang dibagikan, saat ini _mungkin_ tepat. Misalnya, dalam komponen abstrak yang berinteraksi dengan API JavaScript alih-alih merender HTML, seperti komponen Google Maps untuk hipotetis ini: ```html @@ -63,9 +64,9 @@ There are cases however, particularly shared component libraries, when this _mig ``` -The `` component might define a `map` property that all subcomponents need access to. In this case `` might want to access that map with something like `this.$parent.getMap`, in order to add a set of markers to it. You can see this pattern [in action here](https://jsfiddle.net/chrisvfritz/ttzutdxh/). +Komponen `` mungkin mendefinisikan properti `map` yang aksesnya diperlukan oleh semua subkomponen. Dalam kasus ini `` mungkin ingin mengakses `map` itu dengan sesuatu seperti `this.$parent.getMap`, untuk menambahkan satu set *markers* ke dalamnya. Anda dapat melihat pola ini [beraksi di sini](https://jsfiddle.net/chrisvfritz/ttzutdxh/). -Keep in mind, however, that components built with this pattern are still inherently fragile. For example, imagine we add a new `` component and when `` appears within that, it should only render markers that fall within that region: +Ingatlah, komponen yang dibangun dengan pola ini masih rapuh. Sebagai contoh, bayangkan kita menambahkan komponen `` baru dan ketika `` muncul di dalamnya, komponen tersebut seharusnya hanya *render* *markers* yang terdapat di wilayah tersebut. ```html @@ -75,58 +76,57 @@ Keep in mind, however, that components built with this pattern are still inheren ``` -Then inside `` you might find yourself reaching for a hack like this: +Kemudian di dalam `` Anda mungkin akan melakukan hack seperti ini: ```js var map = this.$parent.map || this.$parent.$parent.map ``` -This has quickly gotten out of hand. That's why to provide context information to descendent components arbitrarily deep, we instead recommend [dependency injection](#Dependency-Injection). +Hal ini dengan cepat tak terkendali. Oleh sebab itu untuk menyediakan konteks informasi yang diturunkan ke komponen semaunya, kami menawarkan [*dependency injection*](#Dependency-Injection). -### Accessing Child Component Instances & Child Elements +### Mengakses *Instance* Komponen Anak & Elemen Anak -Despite the existence of props and events, sometimes you might still need to directly access a child component in JavaScript. To achieve this you can assign a reference ID to the child component using the `ref` attribute. For example: +Meskipun ada *props* dan *events*, terkadang Anda mungkin masih perlu mengakses langsung komponen anak dalam JavaScript. Untuk mencapai ini, Anda dapat menetapkan ID referensi ke komponen anak menggunakan atribut `ref`. Sebagai contoh: ```html ``` -Now in the component where you've defined this `ref`, you can use: +Sekarang di komponen tempat Anda mendefinisikan `ref`, Anda dapat menggunakannya: ```js this.$refs.usernameInput ``` -to access the `` instance. This may be useful when you want to, for example, programmatically focus this input from a parent. In that case, the `` component may similarly use a `ref` to provide access to specific elements inside it, such as: +Untuk mengakses instance ``. Hal ini mungkin berguna saat Anda mau, sebagai contoh, secara terprogram memfokuskan input dari induk. Dalam kasus ini, komponen `` juga dapat menggunakan `ref` untuk menyediakan akses ke elemen tertentu di dalamnya, seperti: ```html ``` -And even define methods for use by the parent: +Dan bahkan mendefinisikan metode untuk digunakan oleh induk: ```js methods: { - // Used to focus the input from the parent + // Digunakan untuk memfokuskan input dari induk focus: function () { this.$refs.input.focus() } } ``` -Thus allowing the parent component to focus the input inside `` with: +Dengan demikian memungkinkan komponen induk untuk memfokuskan input di dalam `` dengan: ```js this.$refs.usernameInput.focus() ``` -When `ref` is used together with `v-for`, the ref you get will be an array containing the child components mirroring the data source. - -

$refs are only populated after the component has been rendered, and they are not reactive. It is only meant as an escape hatch for direct child manipulation - you should avoid accessing $refs from within templates or computed properties.

+Ketika `ref` digunakan bersama dengan `v-for`, referensi yang Anda dapatkan akan berupa array yang mengandung komponen turunan yang mencerminkan sumber data. +

$refs hanya diisi setelah komponen telah di-render, dan mereka tidak reaktif. Ini hanya dimaksudkan sebagai jalan keluar untuk manipulasi komponen anak secara langsung - Anda harus menghindari mengakses $refs dari dalam templat dan properti computed.

### Dependency Injection -Earlier, when we described [Accessing the Parent Component Instance](#Accessing-the-Parent-Component-Instance), we showed an example like this: +Sebelumnya, ketika kami jelaskan [Mengakses *instance* induk komponen](#Mengakses-*instance*-induk-komponen), kami menunjukkan contoh seperti ini: ```html @@ -136,9 +136,9 @@ Earlier, when we described [Accessing the Parent Component Instance](#Accessing- ``` -In this component, all descendants of `` needed access to a `getMap` method, in order to know which map to interact with. Unfortunately, using the `$parent` property didn't scale well to more deeply nested components. That's where dependency injection can be useful, using two new instance options: `provide` and `inject`. +Dalam komponen ini, semua keturunan dari `` membutuhkan akses ke metode `getMap`, untuk mengetahui peta mana yang harus berinteraksi. Sayangnya, menggunakan properti `$parent` tidak berskala dengan baik untuk komponen yang bersarang lebih dalam. Di situlah *dependency injection* dapat bermanfaat, menggunakan dua opsi baru *instance*: `provide` dan` inject`. -The `provide` options allows us to specify the data/methods we want to **provide** to descendent components. In this case, that's the `getMap` method inside ``: +Opsi `provide` memungkinkan kita untuk menentukan data/metode yang ingin kita **berikan** untuk komponen turunan. Dalam kasus ini, itulah metode `getMap` di dalam` `: ```js provide: function () { @@ -148,56 +148,56 @@ provide: function () { } ``` -Then in any descendants, we can use the `inject` option to receive specific properties we'd like to add to that instance: +Kemudian pada keturunannya, kita bisa menggunakan opsi `inject` untuk menerima properti tertentu yang ingin kita tambahkan ke *instance* tersebut: ```js inject: ['getMap'] ``` -You can see the [full example here](https://jsfiddle.net/chrisvfritz/tdv8dt3s/). The advantage over using `$parent` is that we can access `getMap` in _any_ descendant component, without exposing the entire instance of ``. This allows us to more safely keep developing that component, without fear that we might change/remove something that a child component is relying on. The interface between these components remains clearly defined, just as with `props`. +Anda dapat melihat [contoh lengkap disini](https://jsfiddle.net/chrisvfritz/tdv8dt3s/). Keuntungan dibanding menggunakan `$parent` adalah bahwa kita dapat mengakses `getMap` dalam _semua_ komponen turunan, tanpa memaparkan seluruh instance dari ``. Ini memungkinkan kita lebih aman untuk terus mengembangkan komponen tersebut, tanpa ada rasa takut kita dapat mengubah/menghapus sesuatu yang digunakan komponen anak. Antarmuka antara komponen ini tetap jelas, sama seperti dengan `props`. -In fact, you can think of dependency injection as sort of "long-range props", except: +Bahkan, Anda bisa menganggap *dependency injection* sebagai semacam *"props jarak jauh"*, kecuali: -* ancestor components don't need to know which descendants use the properties it provides -* descendant components don't need to know where injected properties are coming from +* komponen leluhur tidak perlu tahu keturunan mana yang menggunakan properti yang disediakannya +* komponen turunan tidak perlu tahu dari mana properti yang dioper berasal -

However, there are downsides to dependency injection. It couples components in your application to the way they're currently organized, making refactoring more difficult. Provided properties are also not reactive. This is by design, because using them to create a central data store scales just as poorly as using $root for the same purpose. If the properties you want to share are specific to your app, rather than generic, or if you ever want to update provided data inside ancestors, then that's a good sign that you probably need a real state management solution like Vuex instead.

+

Namun, ada kelemahan untuk dependency injection. Dependency injection memasangkan komponen dalam aplikasi Anda dengan cara mereka saat diatur, membuat refactoring menjadi lebih sulit. Properti yang disediakan juga tidak reaktif. Hal ini dengan sengaja dilakukan, karena perkembangan menggunakan mereka untuk membuat data store terpusat sama buruknya dengan menggunakan $root untuk tujuan yang sama. Jika properti yang ingin Anda bagikan spesifik untuk applikasi Anda, atau jika Anda ingin memperbarui data yang disediakan di dalam leluhur, maka itu pertanda baik bahwa Anda mungkin membutuhkan solusi manajemen state seperti Vuex sebagai gantinya.

-Learn more about dependency injection in [the API doc](https://vuejs.org/v2/api/#provide-inject). +Belajar lebih tentang *dependency injection* di [the API doc](https://vuejs.org/v2/api/#provide-inject). -## Programmatic Event Listeners +## *Event Listeners* Terprogram -So far, you've seen uses of `$emit`, listened to with `v-on`, but Vue instances also offer other methods in its events interface. We can: +Sejauh ini, Anda telah melihat penggunaan `$emit`, dipantau dengan `v-on`, tetapi *instance* Vue juga menawarkan metode lain di antarmuka *event*. Kita dapat: -- Listen for an event with `$on(eventName, eventHandler)` -- Listen for an event only once with `$once(eventName, eventHandler)` -- Stop listening for an event with `$off(eventName, eventHandler)` +- Pantau sebuah *event* dengan `$on(eventName, eventHandler)` +- Pantau sekali *event* dengan`$once(eventName, eventHandler)` +- Berhenti pantau *event* dengan `$off(eventName, eventHandler)` -You normally won't have to use these, but they're available for cases when you need to manually listen for events on a component instance. They can also be useful as a code organization tool. For example, you may often see this pattern for integrating a 3rd-party library: +Anda biasanya tidak harus menggunakan ini, tetapi mereka tersedia untuk kasus-kasus ketika Anda perlu secara manual mendengarkan *event* pada instance komponen. Mereka juga dapat berguna sebagai alat organisasi kode. Sebagai contoh, Anda mungkin sering melihat pola ini untuk diintegrasikan dengan pustaka pihak ke-3: ```js -// Attach the datepicker to an input once -// it's mounted to the DOM. +// Pasang datepicker ke input sekali +// pasang ke DOM. mounted: function () { - // Pikaday is a 3rd-party datepicker library + // Pikaday adalah pustaka data pihak ketiga this.picker = new Pikaday({ field: this.$refs.input, format: 'YYYY-MM-DD' }) }, -// Right before the component is destroyed, -// also destroy the datepicker. +// Tepat sebelum komponen dihancurkan, +// juga menghancurkan datepicker. beforeDestroy: function () { this.picker.destroy() } ``` -This has two potential issues: +Ini memiliki dua masalah potensial: -- It requires saving the `picker` to the component instance, when it's possible that only lifecycle hooks need access to it. This isn't terrible, but it could be considered clutter. -- Our setup code is kept separate from our cleanup code, making it more difficult to programmatically clean up anything we set up. +- Membutuhkan penyimpanan `picker` ke instance komponen, bila memungkinkan, hanya kait siklus hidup [(lifecycle hooks)](https://docs.vuejs.id/v2/api/#Options-Lifecycle-Hooks) yang memerlukan akses ke sana. Ini tidak buruk, tetapi bisa dianggap berantakan. +- Kode pengaturan kita disimpan terpisah dari kode pembersihan kita, membuatnya lebih sulit untuk secara terprogram membersihkan apa pun yang kita atur. -You could resolve both issues with a programmatic listener: +Anda bisa menyelesaikan kedua masalah dengan *Event Listeners* Terprogram: ```js mounted: function () { @@ -212,7 +212,7 @@ mounted: function () { } ``` -Using this strategy, we could even use Pikaday with several input elements, with each new instance automatically cleaning up after itself: +Dengan menggunakan strategi ini, kita bahkan dapat menggunakan Pikaday dengan beberapa elemen input, dengan setiap instance baru secara otomatis membersihkannya sendiri: ```js mounted: function () { @@ -233,23 +233,23 @@ methods: { } ``` -See [this fiddle](https://jsfiddle.net/chrisvfritz/1Leb7up8/) for the full code. Note, however, that if you find yourself having to do a lot of setup and cleanup within a single component, the best solution will usually be to create more modular components. In this case, we'd recommend creating a reusable `` component. +Lihat [fiddle ini](https://jsfiddle.net/chrisvfritz/1Leb7up8/) untuk kode lengkap. Perhatikan, namun, bahwa jika Anda harus melakukan banyak pengaturan dan pembersihan dalam satu komponen, solusi terbaik biasanya adalah membuat lebih banyak komponen modular. Dalam hal ini, kami sarankan untuk membuat komponen `` yang dapat digunakan kembali. -To learn more about programmatic listeners, check out the API for [Events Instance Methods](https://vuejs.org/v2/api/#Instance-Methods-Events). +Untuk mempelajari lebih lanjut tentang *Listeners* Terprogram, lihat API untuk [Metode *Events Instance*](https://vuejs.org/v2/api/#Instance-Methods-Events). -

Note that Vue's event system is different from the browser's EventTarget API. Though they work similarly, $emit, $on, and $off are not aliases for dispatchEvent, addEventListener, and removeEventListener.

+

Perhatikan bahwa sistem event Vue berbeda dari API EventTarget browser. Walaupun mereka bekerja dengan cara yang sama, $emit, $on, dan $off bukan alias untuk dispatchEvent, addEventListener, dan removeEventListener.

-## Circular References +## Komponen Sirkuler (Circular Component) -### Recursive Components +### Komponen Rekursif (Recursive Component) -Components can recursively invoke themselves in their own template. However, they can only do so with the `name` option: +Komponen dapat secara rekursif memanggil dirinya sendiri dalam templatnya sendiri. Namun, mereka hanya dapat melakukannya dengan opsi `name`: ``` js name: 'unique-name-of-my-component' ``` -When you register a component globally using `Vue.component`, the global ID is automatically set as the component's `name` option. +Ketika Anda mendaftarkan komponen secara global menggunakan `Vue.component`, ID global secara otomatis ditetapkan sebagai opsi `nama` komponen. ``` js Vue.component('unique-name-of-my-component', { @@ -257,18 +257,18 @@ Vue.component('unique-name-of-my-component', { }) ``` -If you're not careful, recursive components can also lead to infinite loops: +Jika Anda tidak hati-hati, komponen rekursif juga dapat menyebabkan loop tak terbatas: ``` js name: 'stack-overflow', template: '
' ``` -A component like the above will result in a "max stack size exceeded" error, so make sure recursive invocation is conditional (i.e. uses a `v-if` that will eventually be `false`). +Komponen seperti di atas akan menghasilkan kesalahan ["max stack size exceeded"](https://developer.mozilla.org/en-US/docs/Glossary/Call_stack), jadi pastikan pemanggilan rekursif bersifat kondisional (yaitu menggunakan `v-if` yang akhirnya akan menjadi `false`). -### Circular References Between Components +### *Circular References* Antara Komponen -Let's say you're building a file directory tree, like in Finder or File Explorer. You might have a `tree-folder` component with this template: +Katakanlah Anda sedang membangun pohon direktori file, seperti di *Finder* atau File *Explorer*. Anda mungkin memiliki komponen `tree-folder` dengan templat ini: ``` html

@@ -277,7 +277,7 @@ Let's say you're building a file directory tree, like in Finder or File Explorer

``` -Then a `tree-folder-contents` component with this template: +Kemudian komponen `tree-folder-content` dengan templat ini: ``` html
    @@ -288,17 +288,17 @@ Then a `tree-folder-contents` component with this template:
``` -When you look closely, you'll see that these components will actually be each other's descendent _and_ ancestor in the render tree - a paradox! When registering components globally with `Vue.component`, this paradox is resolved for you automatically. If that's you, you can stop reading here. +Ketika Anda teliti, Anda akan melihat bahwa komponen ini sebenarnya akan menjadi keturunan _dan_ leluhur satu sama lain di pohon *render* - sebuah paradoks! Saat mendaftarkan komponen secara global dengan `Vue.component`, Paradoks ini secara otomatis deselesaikan untuk anda. Jika itu Anda, maka Anda bisa berhenti membaca disini -However, if you're requiring/importing components using a __module system__, e.g. via Webpack or Browserify, you'll get an error: +Namun, jika Anda melakukan *requiring/importing* komponen menggunakan __sistem modul__, misalnya melalui *Webpack* atau *Browserify*, Anda akan mendapatkan kesalahan: ``` Failed to mount component: template or render function not defined. ``` -To explain what's happening, let's call our components A and B. The module system sees that it needs A, but first A needs B, but B needs A, but A needs B, etc. It's stuck in a loop, not knowing how to fully resolve either component without first resolving the other. To fix this, we need to give the module system a point at which it can say, "A needs B _eventually_, but there's no need to resolve B first." +Untuk menjelaskan apa yang terjadi, sebut saja komponen kita A dan B. Sistem modul melihat bahwa ia membutuhkan A, tetapi pertama A membutuhkan B, tetapi B membutuhkan A, tetapi A membutuhkan B, dan seterusnya. komponen tersebut terjebak dalam satu lingkaran, tidak tahu bagaimana menyelesaikan kedua komponen tanpa terlebih dahulu menyelesaikan yang lain. Untuk memperbaikinya, kita perlu memberikan sistem modul titik di mana ia dapat mengatakan, "_Pada akhirnya_ A membutuhkan B, tapi kita tidak perlu menyelesaikan B dulu." -In our case, let's make that point the `tree-folder` component. We know the child that creates the paradox is the `tree-folder-contents` component, so we'll wait until the `beforeCreate` lifecycle hook to register it: +Dalam kasus kita, mari kita buat titk itu menjadi komponen `tree-folder`. Kita tahu anak yang menciptakan paradoks adalah komponen `tree-folder-contents`, jadi kita akan menunggu sampai kait siklus hidup *(lifecycle hooks)* `beforeCreate` untuk mendaftarkannya: ``` js beforeCreate: function () { @@ -306,7 +306,7 @@ beforeCreate: function () { } ``` -Or alternatively, you could use Webpack's asynchronous `import` when you register the component locally: +Atau sebagai alternatif, Anda bisa menggunakan `Import` asinkron *Webpack* ketika Anda mendaftarkan komponen secara lokal: ``` js components: { @@ -314,13 +314,13 @@ components: { } ``` -Problem solved! +Masalah terpecahkan! -## Alternate Template Definitions +## Definisi Templat Alternatif -### Inline Templates +### Templat *Inline* -When the `inline-template` special attribute is present on a child component, the component will use its inner content as its template, rather than treating it as distributed content. This allows more flexible template-authoring. +Ketika atribut khusus `inline-template` ada pada komponen turunan, komponen akan menggunakan konten dalamnya sebagai templatnya, dari pada memperlakukannya sebagai konten yang didistribusikan. Ini memungkinkan pembuatan template yang lebih fleksibel. ``` html @@ -331,13 +331,13 @@ When the `inline-template` special attribute is present on a child component, th ``` -Your inline template needs to be defined inside the DOM element to which Vue is attached. +Template *inline* Anda harus didefinisikan di dalam elemen DOM yang dilampirkan Vue. -

However, inline-template makes the scope of your templates harder to reason about. As a best practice, prefer defining templates inside the component using the template option or in a <template> element in a .vue file.

+

Namun, inline-template membuat cakupan template Anda lebih sulit untuk dipikirkan. Sebagai praktik terbaik, kita lebih suka mendefinisikan templat di dalam komponen menggunakan opsi template atau dalam <elemen templat> dalam file .vue.

### X-Templates -Another way to define templates is inside of a script element with the type `text/x-template`, then referencing the template by an id. For example: +Cara lain untuk mendefinisikan template adalah di dalam elemen skrip dengan tipe `text/x-template`, lalu merujuk template dengan id. Sebagai contoh: ``` html {% endraw %} -Since components are reusable Vue instances, they accept the same options as `new Vue`, such as `data`, `computed`, `watch`, `methods`, and lifecycle hooks. The only exceptions are a few root-specific options like `el`. +Karena komponen adalah Vue _instance_ yang bisa digunakan kembali, mereka menerima opsi yang sama dengan `new Vue`, seperti `data`, `computed`, `watch`, `methods`, dan kait siklus hidup (_lifecycle hooks_). Satu-satunya pengecualian adalah beberapa opsi khusus seperti `el`. -## Reusing Components +## Menggunakan Kembali Komponen -Components can be reused as many times as you want: +Komponen dapat digunakan kembali sebanyak yang Anda inginkan: ```html
@@ -74,11 +74,11 @@ new Vue({ el: '#components-demo2' }) {% endraw %} -Notice that when clicking on the buttons, each one maintains its own, separate `count`. That's because each time you use a component, a new **instance** of it is created. +Perhatikan ketika mengklik tombol, masing-masing mempertahankan `count` itu sendiri secara terpisah. Itu karena setiap kali Anda menggunakan komponen, **_instance_** baru akan dibuat. -### `data` Must Be a Function +### `data` Harus Berupa Fungsi -When we defined the `` component, you may have noticed that `data` wasn't directly provided an object, like this: +Ketika kita mendefinisikan komponen ``, Anda mungkin memperhatikan bahwa `data` secara tidak langsung berupa sebuah objek, seperti ini: ```js data: { @@ -86,7 +86,7 @@ data: { } ``` -Instead, **a component's `data` option must be a function**, so that each instance can maintain an independent copy of the returned data object: +Sebagai gantinya, **opsi `data` pada komponen harus berupa fungsi**, sehingga setiap _instance_ dapat mempertahankan salinan independen dari objek data yang dikembalikan: ```js data: function () { @@ -96,7 +96,7 @@ data: function () { } ``` -If Vue didn't have this rule, clicking on one button would affect the data of _all other instances_, like below: +Jika Vue tidak memiliki aturan ini, maka ketika mengklik satu tombol akan mempengaruhi semua data, seperti di bawah ini: {% raw %}
@@ -112,37 +112,37 @@ Vue.component('button-counter2', { data: function () { return buttonCounter2Data }, - template: '' + template: '' }) new Vue({ el: '#components-demo3' }) {% endraw %} -## Organizing Components +## Pengorganisasian Komponen -It's common for an app to be organized into a tree of nested components: +Biasanya aplikasi diorganisasikan ke dalam kumpulan komponen bersarang: -![Component Tree](/images/components.png) +![Komponen Bersarang](/images/components.png) -For example, you might have components for a header, sidebar, and content area, each typically containing other components for navigation links, blog posts, etc. +Sebagai contoh, Anda mungkin memiliki komponen _header_, bilah samping (_sidebar_), dan area konten, masing-masing biasanya berisi komponen lain untuk tautan navigasi, posting blog, dan sebagainya. -To use these components in templates, they must be registered so that Vue knows about them. There are two types of component registration: **global** and **local**. So far, we've only registered components globally, using `Vue.component`: +Untuk menggunakan komponen ini dalam templat, mereka harus didaftarkan agar Vue tahu tentang mereka. Ada dua tipe untuk mendaftarkan: **global** dan **local**. Sejauh ini, Kita hanya mendaftarkan komponen secara global, menggunakan `Vue.component`: ```js Vue.component('my-component-name', { - // ... options ... + // ... opsi ... }) ``` -Globally registered components can be used in the template of any root Vue instance (`new Vue`) created afterwards -- and even inside all subcomponents of that Vue instance's component tree. +Komponen yang terdaftar secara global dapat digunakan dalam templat dari _instance_ Vue Root (`new Vue`) yang dibuat setelahnya -- dan bahkan di dalam semua sub komponen dari pohon komponen Vue _instance_. -That's all you need to know about registration for now, but once you've finished reading this page and feel comfortable with its content, we recommend coming back later to read the full guide on [Component Registration](components-registration.html). +Itu saja yang perlu Anda ketahui tentang pendaftaran untuk saat ini, tetapi setelah selesai membaca halaman ini dan merasa nyaman dengan isinya, kami sarankan untuk kembali lagi nanti untuk membaca panduan lengkap tentang [Mendaftarkan Komponen](components-registration.html). -## Passing Data to Child Components with Props +## Mengoper Data ke Anak Komponen dengan Props -Earlier, we mentioned creating a component for blog posts. The problem is, that component won't be useful unless you can pass data to it, such as the title and content of the specific post we want to display. That's where props come in. +Sebelumnya, kita membuat contoh komponen untuk posting blog. Masalahnya adalah, komponen itu tidak akan berguna kecuali Anda dapat mengoper data ke dalamnya, seperti judul dan konten dari pos tertentu yang ingin kita tampilkan. Di situlah kegunaan _props_. -Props are custom attributes you can register on a component. When a value is passed to a prop attribute, it becomes a property on that component instance. To pass a title to our blog post component, we can include it in the list of props this component accepts, using a `props` option: +_Props_ adalah kustom atribut yang dapat Anda daftarkan pada suatu komponen. Ketika nilai diopen ke atibut prop, itu menjadi properti pada _instance_ komponen itu. Untuk mengoper judul ke komponen posting blog, kita dapat memasukannya dalam daftar properti yang diterima komponen ini, menggunakan opsi `props`: ```js Vue.component('blog-post', { @@ -151,21 +151,21 @@ Vue.component('blog-post', { }) ``` -A component can have as many props as you'd like and by default, any value can be passed to any prop. In the template above, you'll see that we can access this value on the component instance, just like with `data`. +Sebuah komponen dapat memiliki dapat memiliki banyak props seperti yang Anda inginkan dan secara default, nilai apa pun dapat diteruskan ke prop apa pun. Dalam templat di atas, Anda akan melihat bahwa kami dapat mengakses nilai ini pada _instance_ komponen, sama seperti dengan `data`. -Once a prop is registered, you can pass data to it as a custom attribute, like this: +Setelah prop terdaftar, Anda dapat mengoper data sebagai atribut khusus, seperti ini: ```html - - - + + + ``` {% raw %}
- - - + + +
{% endraw %} -In a typical app, however, you'll likely have an array of posts in `data`: +Namun, dalam aplikasi yang khas, Anda kemungkinan akan memiliki serangkaian pos dalam `data`: ```js new Vue({ el: '#blog-post-demo', data: { posts: [ - { id: 1, title: 'My journey with Vue' }, - { id: 2, title: 'Blogging with Vue' }, - { id: 3, title: 'Why Vue is so fun' } + { id: 1, title: 'Perjalanan saya dengan Vue' }, + { id: 2, title: 'Blogging dengan Vue' }, + { id: 3, title: 'Mengapa Vue sangat menyenangkan' } ] } }) ``` -Then want to render a component for each one: +Lalu ingin me-rendernya untuk setiap komponen: ```html ``` -Above, you'll see that we can use `v-bind` to dynamically pass props. This is especially useful when you don't know the exact content you're going to render ahead of time, like when [fetching posts from an API](https://jsfiddle.net/chrisvfritz/sbLgr0ad). +Di atas, Anda akan melihat bahwa kita dapat menggunakan `v-bind` secara dinamis menggunakan prop. Ini sangat berguna ketika Anda tidak tahu konten pasti yang akan Anda render sebelumnya, seperti saat [mengambil posting dari API](https://jsfiddle.net/chrisvfritz/sbLgr0ad). -That's all you need to know about props for now, but once you've finished reading this page and feel comfortable with its content, we recommend coming back later to read the full guide on [Props](components-props.html). +Itu saja yang perlu Anda ketahui tentang _props_ untuk saat ini, tetapi setelah selesai membaca halaman ini dan merasa nyaman dengan isinya, kami sarankan untuk kembali lagi nanti untuk membaca panduan lengkap tentang [_Props_](components-props.html). -## A Single Root Element +## Elemen Root Tunggal -When building out a `` component, your template will eventually contain more than just the title: +Saat membuat komponen ``, templat Anda pada akhirnya akan berisi lebih dari sekedar judul: ```html

{{ title }}

``` -At the very least, you'll want to include the post's content: +Setidaknya, Anda ingin memasukan posting konten: ```html

{{ title }}

``` -If you try this in your template however, Vue will show an error, explaining that **every component must have a single root element**. You can fix this error by wrapping the template in a parent element, such as: +Jika Anda mencoba ini di templat Anda, Vue akan memunculkan kesalahan, menjelaskan bahwa **setiap komponen harus memiliki elemen root tunggal**. Anda bisa memperbaiki kesalahan ini dengan membungkus templat dalam elemen induk, seperti: ```html
@@ -229,7 +229,7 @@ If you try this in your template however, Vue will show an error, explaining tha
``` -As our component grows, it's likely we'll not only need the title and content of a post, but also the published date, comments, and more. Defining a prop for each related piece of information could become very annoying: +Seiring komponen tumbuh, kemungkinan kita tidak hanya membutuhkan judul dan konten dari sebuah posting, tetapi juga tanggal diterbitkan, komentar, dan lainnya. Mendefinisikan _prop_ untuk setiap informasi terkait bisa menjadi sangat menjengkelkan: ```html ``` -So this might be a good time to refactor the `` component to accept a single `post` prop instead: +Jadi ini mungkin saat yang tepat untuk memperbaiki komponen `` untuk menerima _prop_ `post` tunggal sebagai gantinya: ```html The above example and some future ones use JavaScript's [template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) to make multi-line templates more readable. These are not supported by Internet Explorer (IE), so if you must support IE and are not transpiling (e.g. with Babel or TypeScript), use [newline escapes](https://css-tricks.com/snippets/javascript/multiline-string-variables-in-javascript/) instead.

+

Contoh di atas dan beberapa yang akan datang menggunakan [templat _literal_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) JavaScript untuk membuat templat beberapa baris sehingga lebih mudah dibaca. Ini tidak didukung oleh Internet Explorer (IE), jadi jika Anda harus mendukung IE dan tidak mentranspeksi (contohnya Babel atau TypeScript), gunakan [lolos baris baru](https://css-tricks.com/snippets/javascript/multiline-string-variables-in-javascript/) sebagai gantinya.

-Now, whenever a new property is added to `post` objects, it will automatically be available inside ``. +Sekarang, properti baru apapun akan di tambahkan ke objek `post`, itu akan otomatis ada didalam ``. -## Listening to Child Components Events +## Memantau _Events_ untuk Anak Komponen -As we develop our `` component, some features may require communicating back up to the parent. For example, we may decide to include an accessibility feature to enlarge the text of blog posts, while leaving the rest of the page its default size: +Saat kita mengembangkan komponen ``, beberapa fitur mungkin membutuhkan komunikasi kembali ke induk. Sebagai contoh, kita mungkin memutuskan untuk memasukan fitur aksesibilitas untuk memperbesar text posting blog, sambil membiarkan sisa halaman ukuran defaultnya: -In the parent, we can support this feature by adding a `postFontSize` data property: +Didalam induk, kita akan mendukung fitur ini dengan menambahkan properti data `postFontSize`: ```js new Vue({ @@ -284,7 +284,7 @@ new Vue({ }) ``` -Which can be used in the template to control the font size of all blog posts: +Yang dapat digunakan dalam templat untuk mengontrol ukuran font semua posting blog: ```html
@@ -298,7 +298,7 @@ Which can be used in the template to control the font size of all blog posts:
``` -Now let's add a button to enlarge the text right before the content of every post: +Sekarang mari kita tambahkan tombol untuk memperbesar teks tepat sebelum konten posting: ```js Vue.component('blog-post', { @@ -307,7 +307,7 @@ Vue.component('blog-post', {

{{ post.title }}

@@ -315,15 +315,15 @@ Vue.component('blog-post', { }) ``` -The problem is, this button doesn't do anything: +Masalahnya adalah, tombol ini tidak mendapatkan apa-apa: ```html ``` -When we click on the button, we need to communicate to the parent that it should enlarge the text of all posts. Fortunately, Vue instances provide a custom events system to solve this problem. The parent can choose to listen to any event on the child component instance with `v-on`, just as we would with a native DOM event: +Ketika kita mengklik tombol, kita perlu untuk berkomunikasi dengan induk bahwa itu harus memperbesar tulisan teks pada semua posting. Untung, Vue _instances_ menyediakan sistem kustom _events_ untuk menyelesaikan masalah ini. Induk dapat memilih untuk memantau _event_ apa pun dengan _instance_ anak komponen dengan `v-on`, sama seperti yang kita lakukan pada _event_ DOM asli: ```html ``` -Then the child component can emit an event on itself by calling the built-in [**`$emit`** method](../api/#vm-emit), passing the name of the event: +Kemudian anak komponen dapat _emit_ (mengeluarkan output) suatu _event_ pada dirinya sendiri dengan memanggil [metode **`$emit`**](../api/#vm-emit) bawaan, mengoper nama dari _event_: ```html ``` -Thanks to the `v-on:enlarge-text="postFontSize += 0.1"` listener, the parent will receive the event and update `postFontSize` value. +Terima kasih kepada _listener_ `v-on:enlarge-text="postFontSize += 0.1"`, induk akan menerima _event_ dan perbaruan isi `postFontSize`. {% raw %}
@@ -370,9 +370,9 @@ new Vue({ el: '#blog-posts-events-demo', data: { posts: [ - { id: 1, title: 'My journey with Vue', content: '...content...' }, - { id: 2, title: 'Blogging with Vue', content: '...content...' }, - { id: 3, title: 'Why Vue is so fun', content: '...content...' } + { id: 1, title: 'Perjalanan saya dengan Vue', content: '...content...' }, + { id: 2, title: 'Blogging dengan Vue', content: '...content...' }, + { id: 3, title: 'Mengapa Vue sangat menyenangkan', content: '...content...' } ], postFontSize: 1 } @@ -380,17 +380,17 @@ new Vue({ {% endraw %} -### Emitting a Value With an Event +### Meng-_Emit_ Nilai dengan _Event_ -It's sometimes useful to emit a specific value with an event. For example, we may want the `` component to be in charge of how much to enlarge the text by. In those cases, we can use `$emit`'s 2nd parameter to provide this value: +Ini terkadang berguna untuk meng-_emit_ nilai spesifik dengan _event_. Sebagai contohnya, kita mungkin menginginkan komponen `` bertanggung jawab atas seberapa banyak teks akan diperbesar. Dalam hal itu, kita akan menggunakan parameter ke-2 `$emit` untuk meng-_emit_ nilai ini: ```html ``` -Then when we listen to the event in the parent, we can access the emitted event's value with `$event`: +Kemudian ketika kita memantau _event_ di induk, kita dapat mengakses nilai _event_ yang di berikan dengan `$event`: ```html ``` -Or, if the event handler is a method: +Atau, jika _event handler_ adalah metode: ```html ``` -Then the value will be passed as the first parameter of that method: +Kemudian nilai akan dikirimkan sebagai parameter pertama dari metode itu: ```js methods: { @@ -418,15 +418,15 @@ methods: { } ``` -### Using `v-model` on Components +### Menggunakan `v-model` pada Komponent -Custom events can also be used to create custom inputs that work with `v-model`. Remember that: +Kustom _events_ juga dapat digunakan untuk membuat kustom _input_ yang berkerja dengan `v-model`. Ingat bahwa: ```html ``` -does the same thing as: +hal yang sama dengan: ```html ``` -When used on a component, `v-model` instead does this: +Saat digunakan pada komponen, sebagai ganti `v-model` gunakan seperti ini: ``` html ``` -For this to actually work though, the `` inside the component must: +Agar ini benar-benar berfungsi, `` di dalam komponen harus: -- Bind the `value` attribute to a `value` prop -- On `input`, emit its own custom `input` event with the new value +- Mengikat atribut `value` ke `nilai` _prop_ +- Pada `input`, _emit event_ kustom `input` dengan nilai baru -Here's that in action: +Di sinilah beraksi: ```js Vue.component('custom-input', { @@ -463,37 +463,37 @@ Vue.component('custom-input', { }) ``` -Now `v-model` should work perfectly with this component: +Sekarang `v-model` seharusnya bekerja dengan sempurna dengan komponen ini: ```html ``` -That's all you need to know about custom component events for now, but once you've finished reading this page and feel comfortable with its content, we recommend coming back later to read the full guide on [Custom Events](components-custom-events.html). +Itu saja yang perlu Anda ketahui tentang kustom _events_ komponen untuk saat ini, tetapi setelah selesai membaca halaman ini dan merasa nyaman dengan isinya, kami sarankan untuk kembali lagi nanti untuk membaca panduan lengkap tentang [Custom Events](components-custom-events.html). -## Content Distribution with Slots +## Distribusi Konten dengan Slots -Just like with HTML elements, it's often useful to be able to pass content to a component, like this: +Sama seperti dengan elemen HTML, seringkali berguna untuk dapat mengoper konten ke komponen, seperti ini: ``` html - Something bad happened. + Sesuatu yang buruk telah terjadi. ``` -Which might render something like: +Yang mungkin me-render sesuatu seperti: {% raw %}
- Something bad happened. + Sesuatu yang buruk telah terjadi.
{% endraw %} -Here we have declared a computed property `reversedMessage`. The function we provided will be used as the getter function for the property `vm.reversedMessage`: +Disini kita telah mendeklarasi properti penghitung `reversedMessage`. Fungsi yang kita sediakan akan digunakan sebagai fungsi *getter* untuk properti `vm.reversedMessage`: ``` js -console.log(vm.reversedMessage) // => 'olleH' -vm.message = 'Goodbye' -console.log(vm.reversedMessage) // => 'eybdooG' +console.log(vm.reversedMessage) // => 'iaH' +vm.message = 'Dah' +console.log(vm.reversedMessage) // => 'haD' ``` -You can open the console and play with the example vm yourself. The value of `vm.reversedMessage` is always dependent on the value of `vm.message`. +Anda dapat membuka konsol *(console)* dan bermain dengan contoh vm sendirian. Nilai dari `vm.reversedMessage` selalu tergantung dengan nilai `vm.message`. -You can data-bind to computed properties in templates just like a normal property. Vue is aware that `vm.reversedMessage` depends on `vm.message`, so it will update any bindings that depend on `vm.reversedMessage` when `vm.message` changes. And the best part is that we've created this dependency relationship declaratively: the computed getter function has no side effects, which makes it easier to test and understand. +Anda bisa melakukan *data-bind* ke properti penghitung di *template* seperti properti normal. Vue sadar bahwa `vm.reversedMessage` tergantung dengan `vm.message`, jadi itu akan merubah semua yang terkait dengan `vm.reversedMessage` ketika `vm.message` berubah. Dan bagian terbaiknya adalah kita telah membuat hubungan *dependency* secara deklaratif : penghitung fungsi *getter* tidak mempunyai efek samping, yang membuat itu menjadi lebih mudah untuk dicoba dan dipahami. -### Computed Caching vs Methods +### Penyimpanan Penghitung (Computed Cache) vs Metode -You may have noticed we can achieve the same result by invoking a method in the expression: +Anda mungkin telah mengerti kita dapat membuat hasil yang sama dengan cara menjalankan metode ini dalam *expression*: ``` html -

Reversed message: "{{ reverseMessage() }}"

+

Pesan terbalik: "{{ reverseMessage() }}"

``` ``` js -// in component +// dalam komponen methods: { reverseMessage: function () { return this.message.split('').reverse().join('') @@ -94,9 +95,9 @@ methods: { } ``` -Instead of a computed property, we can define the same function as a method instead. For the end result, the two approaches are indeed exactly the same. However, the difference is that **computed properties are cached based on their dependencies.** A computed property will only re-evaluate when some of its dependencies have changed. This means as long as `message` has not changed, multiple access to the `reversedMessage` computed property will immediately return the previously computed result without having to run the function again. +Selain properti penghitung, kita dapat menetapkan fungsi yang sama sebagai metode. Untuk hasil akhirnya, dua pendekatan memang sama persis. Tetapi, perbedaanya adalah **properti penghitung** di simpan berdasarkan *dependencies* mereka.** Sebuah properti penghitung hanya akan mengevaluasi ulang ketika salah satu *dependencies* mereka telah berubah. Ini berarti selama `message` belum berubah, semua akses ke `reversedMessage` properti penghitung akan langsung kembali ke hasil penghitungan sebelumnya tanpa harus menjalankan ulang fungsi tersebut -This also means the following computed property will never update, because `Date.now()` is not a reactive dependency: +Ini juga berarti properti penghitung dibawah tidak akan pernah berubah, karena `Date.now()` bukan *dependency* reaktif: ``` js computed: { @@ -106,13 +107,13 @@ computed: { } ``` -In comparison, a method invocation will **always** run the function whenever a re-render happens. +Sebagai perbandingan, sebuah pemanggilan metode akan **selalu** menjalankan fungsi kapanpun ketika sebuah render ulang terjadi. -Why do we need caching? Imagine we have an expensive computed property **A**, which requires looping through a huge Array and doing a lot of computations. Then we may have other computed properties that in turn depend on **A**. Without caching, we would be executing **A**’s getter many more times than necessary! In cases where you do not want caching, use a method instead. +Kenapa kita membutuhkan penyimpanan *(caching)* ? Bayangkan kita mempunyai sebuah *expensive computed property* bernama **A**, yang membutuhkan pengulangan melewati *Array* yang besar dan mengerjakan banyak perhitungan. Lalu kita mungkin mempunyai properti penghitung lainya yang tergantung dari **A**. Tanpa penyimpanan *(caching)*, kita mungkin akan menjalankan *getter* milik **A** lebih dari yang dibutuhkan! Ketika anda tidak butuh penyimpanan *(caching)*, gunakan metode sebagi gantinya. -### Computed vs Watched Property +### Properti Penghitung vs Properti Pengawas -Vue does provide a more generic way to observe and react to data changes on a Vue instance: **watch properties**. When you have some data that needs to change based on some other data, it is tempting to overuse `watch` - especially if you are coming from an AngularJS background. However, it is often a better idea to use a computed property rather than an imperative `watch` callback. Consider this example: +Vue juga menyediakan banyak cara umum untuk mengamati dan beraksi kepada perubahan data pada sebuah *instance* Vue: **Properti Pengawas *(Watch Properties)***. Ketika anda mempunyai beberapa data yang perlu dirubah berdasarkan data lainya, dan sudah terlalu banyak menggunakan `watch` - khususunya jika anda datang dari latar belakang AngularJS. Namun, terkadang ide yang lebih baik adalah untuk menggunakan properti penghitung daripada sebuah perintah *callback* `watch`. Pertimbangkan contoh ini: ``` html
{{ fullName }}
@@ -137,7 +138,7 @@ var vm = new Vue({ }) ``` -The above code is imperative and repetitive. Compare it with a computed property version: +Kode diatas sangat berulang ulang. Bandingkan itu dengan versi properti penghitung: ``` js var vm = new Vue({ @@ -154,11 +155,11 @@ var vm = new Vue({ }) ``` -Much better, isn't it? +Lebih baik, bukan ? ### Computed Setter -Computed properties are by default getter-only, but you can also provide a setter when you need it: +Properti penghitung pada dasarnya adalah hanya-*getter*, tapi anda juga bisa menyediakan sebuah *setter* ketika anda membutuhkanya: ``` js // ... @@ -179,18 +180,19 @@ computed: { // ... ``` -Now when you run `vm.fullName = 'John Doe'`, the setter will be invoked and `vm.firstName` and `vm.lastName` will be updated accordingly. +Sekarang ketika anda menjalankan `vm.fullName = 'John Doe'`, Sebuah *setter* akan dijalankan dan `vm.firstName` dan `vm.lastName` akan di ubah secara teratur. + +## Pengawas (Watcher) -## Watchers +Ketika properti pengihitung sangat teratur dalam beberapa kasus, ada kalanya sebuah *watcher* kustom dibutuhkan. Itulah kenapa Vue memberikan cara yang lebih umum untuk bereaksi pada saat data berubah melalui pilihan `watch`. Ini sangat berguna ketika anda ingin melakukan operasi *asynchronous* atau operasi *expensive* sebagai balasan perubahan data. -While computed properties are more appropriate in most cases, there are times when a custom watcher is necessary. That's why Vue provides a more generic way to react to data changes through the `watch` option. This is most useful when you want to perform asynchronous or expensive operations in response to changing data. -For example: +Sebagai Contoh: ``` html

- Ask a yes/no question: + Tanyakan pertanyaan iya/tidak:

{{ answer }}

@@ -198,10 +200,10 @@ For example: ``` ``` html - - - - + + + + ``` -Result: +Hasil: {% raw %}

- Ask a yes/no question: + Tanyakan pertanyaan iya/tidak:

{{ answer }}

@@ -266,11 +268,11 @@ var watchExampleVM = new Vue({ el: '#watch-example', data: { question: '', - answer: 'I cannot give you an answer until you ask a question!' + answer: 'Saya tidak dapat memberikan jawaban sampai anda bertanya kepada saya!' }, watch: { question: function (newQuestion, oldQuestion) { - this.answer = 'Waiting for you to stop typing...' + this.answer = 'Menunggu anda untuk berhenti mengetik...' this.debouncedGetAnswer() } }, @@ -280,7 +282,7 @@ var watchExampleVM = new Vue({ methods: { getAnswer: function () { if (this.question.indexOf('?') === -1) { - this.answer = 'Questions usually contain a question mark. ;-)' + this.answer = 'Pertanyaan biasanya berisi tanda tanya. ;-)' return } this.answer = 'Thinking...' @@ -290,7 +292,7 @@ var watchExampleVM = new Vue({ vm.answer = _.capitalize(response.data.answer) }) .catch(function (error) { - vm.answer = 'Error! Could not reach the API. ' + error + vm.answer = 'Error! Tidak dapat meraih API. ' + error }) } } @@ -298,6 +300,6 @@ var watchExampleVM = new Vue({ {% endraw %} -In this case, using the `watch` option allows us to perform an asynchronous operation (accessing an API), limit how often we perform that operation, and set intermediary states until we get a final answer. None of that would be possible with a computed property. +Pada kasus ini, menggunakan pilihan `watch` memungkinkan kita untuk melakukan operasi *asynchronous* (Mengakses API), batasi seberapa sering kita melakukan operasi itu, dan atur status sementara hingga kita mendapatkan jawaban akhir. Semua itu tidak mungkin dilakukan dengan properti yang dihitung. -In addition to the `watch` option, you can also use the imperative [vm.$watch API](../api/#vm-watch). +Sebagai tambahan untuk pilihan `watch`, anda juga bisa menggunakan *imperative* [vm.$watch API](../api/#vm-watch). diff --git a/src/v2/guide/conditional.md b/src/v2/guide/conditional.md index 2221857433..b9b19bfe75 100644 --- a/src/v2/guide/conditional.md +++ b/src/v2/guide/conditional.md @@ -1,56 +1,56 @@ --- -title: Conditional Rendering +title: Rendering Bersyarat type: guide order: 7 --- ## `v-if` -The directive `v-if` is used to conditionally render a block. The block will only be rendered if the directive's expression returns a truthy value. +Instruksi `v-if` biasa digunakan untuk melakukan render sebuah blok secara bersyarat. Blok hanya akan di-*render* apabila ekspresi instruksi mengembalikan nilai benar. ``` html -

Vue is awesome!

+

Vue itu mengagumkan!

``` -It is also possible to add an "else block" with `v-else`: +Juga memungkinkan untuk menambahkan "blok else" dengan `v-else`: ``` html -

Vue is awesome!

-

Oh no 😢

+

Vue itu mengagumkan!

+

Oh tidak 😢

``` -### Conditional Groups with `v-if` on `