Skip to content

List Rendering section translated #12

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 2 commits into from
Aug 26, 2017

Conversation

panietoar
Copy link

No description provided.

@panietoar panietoar mentioned this pull request Aug 25, 2017

> This section assumes knowledge of [Components](components.html). Feel free to skip it and come back later.
> Esta sección asume conocimiento en [Componentes] (components.html). Siéntase de libre de saltarla y regresar más adelante.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cuidado con los espacios, aquí el enlace me parece que está roto.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hecho


Here's a complete example of a simple todo list:
Acá hay un ejemplo completo de una lista de tareas:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La expresión Acá no me parece neutral. Sugiero Aquí tenemos un ejemplo...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hecho


When Vue.js is updating a list of elements rendered with `v-for`, it by default uses an "in-place patch" strategy. If the order of the data items has changed, instead of moving the DOM elements to match the order of the items, Vue will simply patch each element in-place and make sure it reflects what should be rendered at that particular index. This is similar to the behavior of `track-by="$index"` in Vue 1.x.
Cuando Vue.js está actualizando una lista de elementos renderizados con `v-for`, por defecto usa una estrategia "arreglar en-lugar". Si el orden de los elementos de datos cambia, en vez de mover los elementos DOM para ajustar el orden de los elementos, Vue sencillamente arregla cada elemento en su lugar y se asegura que refleje lo que debe ser renderizado en ése índice particular. Ésto es similar al comportamiento de `track-by="$index"` en Vue 1.x.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dejaría "in-place patch" sin traducir.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hecho


This default mode is efficient, but only suitable **when your list render output does not rely on child component state or temporary DOM state (e.g. form input values)**.
Este modo por defecto es eficiente, pero sólo recomendable **cuando su salida de renderizado de la lista no dependa del estado de componentes hijos o estado temporal DOM (p.e. valores de campos de formulario)**.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...**cuando el renderizado de la lista no dependa del estado de sus componentes hijos o del estado temporal DOM...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hecho


To give Vue a hint so that it can track each node's identity, and thus reuse and reorder existing elements, you need to provide a unique `key` attribute for each item. An ideal value for `key` would be the unique id of each item. This special attribute is a rough equivalent to `track-by` in 1.x, but it works like an attribute, so you need to use `v-bind` to bind it to dynamic values (using shorthand here):
Para darle a Vue una indicación para que pueda rastrear la identidad de cada nodo, y así re-usar y re-ordenar elementos existentes, necesita poveer un atributo único `key` para cada elemento. Un valor ideal para `key` sería el id único de cada elemento. Este atributo especial es un equivalente similar a `track-by` de la versión 1.x, pero funciona como un atributo, de modo que necesita usar `v-bind` para asignar valores dinámicos (usando una versión corta así):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya que se refiere al ejemplo, creo que la corrección mas adecuada sería aquí. (usando una versión corta aquí)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hecho


To overcome caveat 1, both of the following will accomplish the same as `vm.items[indexOfItem] = newValue`, but will also trigger state updates in the reactivity system:
Para solventar el problema 1, los siguientes arreglos pueden lograr lo mismo que `vm.items[indexOfItem] = newValue`, pero a su vez acgtivan actualizaciones de estado en el sistema reactivo:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo en acgtivan.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muchas gracias, hecho

@miljan-aleksic miljan-aleksic merged commit 547f35d into vuejs-es:master Aug 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants