Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 850c323

Browse files
Merge pull request #1 from Adamkillander96/patch-1
docs: How to deal with v-ga in v-for
2 parents 8161690 + 3161739 commit 850c323

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/v-ga.md

+22
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,25 @@ If there's no need to pass any arguments, we could also just pass the name of th
110110
}
111111
</script>
112112
```
113+
114+
### v-ga in v-for loops
115+
'this' is not available when using it on a child in a v-for loop. In that case, use '$parent' instead.
116+
117+
```html
118+
<template>
119+
<div v-for="button in buttons" :key="button.key">
120+
<button v-ga="$ga.commands.trackFocus.bind($parent, button.value)">{{ button.name }}</button>
121+
</div>
122+
</template>
123+
124+
<script>
125+
export default {
126+
name: 'myComponent',
127+
data: () => ({
128+
buttons: [
129+
{ name: 'Click me', value: 1 }
130+
]
131+
})
132+
}
133+
</script>
134+
```

0 commit comments

Comments
 (0)