Skip to content

Conversation

@guilemos
Copy link
Contributor

  1. Support to map only one row that lives at a array/object when we are out of a loop and map all object properties

This is useful when working with "active row".

const state = {
  byId: {
    "/rooms/1": {
        name: "Nice room"
    },
    "/rooms/2": {
        name: "Nice room 2"
    },
  },
  allIds: ["/rooms/1", "/rooms/2"],
};
...mapFields('rooms', { item: 'byId[/rooms/2]' }),
<template>
    <v-input v-model="item.name" />
</template>
  1. Support to accept functions as path for mapFields and mapMultiRowFields
    This is useful to make map dynamic.
const state = {
  byId: {
    "/rooms/1": {
        name: "Nice room"
    },
    "/rooms/2": {
        name: "Nice room 2"
    },
  },
  allIds: ["/rooms/1", "/rooms/2"],
};
data() {
  return {
    ative_room: '0'
  };
},
computed: {
  ...mapFields({name: (c) => `users[${c.ative_room}].name` }),
}
<div>
   <input v-model="name">
</div>

Thank you

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 50e3c03 on guilemos:feature/mapFields-accept-function-and-map-entire-objects into ae30a03 on maoberlehner:master.

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