forked from vuejs/docs
-
Notifications
You must be signed in to change notification settings - Fork 11
docs(i18n-id): Provide Indonesian translation for array-refs, async-components, and attribute coercion #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
291e376
docs(i18n-id): Provide Indonesian translation for array-ref
Namchee aee2df1
docs(i18n-id): Provide Indonesian translation for async-components
Namchee 0a5f463
docs(i18n-id): Provide Indonesian translation for attribute-coercion.MD
Namchee 027276c
chore: Remove package-lock.json
Namchee fb8f615
docs(i18n-id): Rephrase 'conitnue reading' sentence
Namchee d95524b
docs(i18n-id): Translate missing words
Namchee 7bc3cb3
docs(i18n-id): Remove package-lock.json
Namchee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
--- | ||
title: v-for Array Refs | ||
title: v-for Pada Array Refs | ||
badges: | ||
- breaking | ||
--- | ||
|
||
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" /> | ||
|
||
In Vue 2, using the `ref` attribute inside `v-for` will populate the corresponding `$refs` property with an array of refs. This behavior becomes ambiguous and inefficient when there are nested `v-for`s present. | ||
Pada Vue versi 2, penggunaan atribut `ref` di dalam `v-for` akan mengisi properti `$refs` dengan sebuah `ref` _array_. Perilaku tersebut menjadi ambigu dan tidak efisien ketika dilakukan pada `v-for` bersarang. | ||
|
||
In Vue 3, such usage will no longer automatically create an array in `$refs`. To retrieve multiple refs from a single binding, bind `ref` to a function which provides more flexibility (this is a new feature): | ||
Pada Vue versi 3, penggunaan tersebut tidak akan secara otomatis membuat sebuah _array_ pada `$refs`. Untuk mendapatkan banyak `ref` sekaligus dalam satu _binding_, _bind_ `ref` pada sebuah fungsi dimana hal tersebut memberikan lebih banyak fleskibilitas (hal ini merupakan sebuah fitur baru): | ||
|
||
```html | ||
<div v-for="item in list" :ref="setItemRef"></div> | ||
<div v-for="barang in daftar" :ref="tetapkanRefBarang"></div> | ||
``` | ||
|
||
With Options API: | ||
Penggunaan dengan Options API: | ||
|
||
```js | ||
export default { | ||
data() { | ||
return { | ||
itemRefs: [] | ||
refBarang: [] | ||
} | ||
}, | ||
methods: { | ||
setItemRef(el) { | ||
this.itemRefs.push(el) | ||
tetapkanRefBarang(el) { | ||
this.refBarang.push(el) | ||
} | ||
}, | ||
beforeUpdate() { | ||
this.itemRefs = [] | ||
this.refBarang = [] | ||
}, | ||
updated() { | ||
console.log(this.itemRefs) | ||
console.log(this.refBarang) | ||
} | ||
} | ||
``` | ||
|
||
With Composition API: | ||
Penggunaan dengan Composition API: | ||
|
||
```js | ||
import { ref, onBeforeUpdate, onUpdated } from 'vue' | ||
|
||
export default { | ||
setup() { | ||
let itemRefs = [] | ||
const setItemRef = el => { | ||
itemRefs.push(el) | ||
let refBarang = [] | ||
const tetapkanRefBarang = el => { | ||
refBarang.push(el) | ||
} | ||
onBeforeUpdate(() => { | ||
itemRefs = [] | ||
refBarang = [] | ||
}) | ||
onUpdated(() => { | ||
console.log(itemRefs) | ||
console.log(refBarang) | ||
}) | ||
return { | ||
itemRefs, | ||
setItemRef | ||
refBarang, | ||
tetapkanRefBarang | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Note that: | ||
Ingat bahwa: | ||
|
||
- `itemRefs` doesn't have to be an array: it can also be an object where the refs are set by their iteration keys. | ||
- `refBarang` tidak harus merupakan sebuah _array_: boleh berupa sebuah objek dimana `ref` ditetapkan menggunakan kunci iterasi masing-masing. | ||
|
||
- This also allows `itemRefs` to be made reactive and watched, if needed. | ||
- Cara ini juga memungkinkan `refBarang` untuk dijadikan reaktif dan dapat diawasi, jika dibutuhkan. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.