[Vuejs]-Access "this" in template

1👍

Just use a method:

:layer="getLayer(layer)"
methods: {
  getLayer(layer) {
    return this[layer]
  }
}

0👍

Since component instance isn’t available as this inside v-for, it can be replaced with _self:

:layer="_self[layer]"

Or if specified dynamic property names were data, $data could be used:

:layer="$data[layer]"

Leave a comment