подскажите почему ошибка this is undefined ?
<template>
<div>
<button class="btn btn-success" @click="addRow">Добавить в новый массив</button>
<pre><code>{{ newRole }}</code></pre>
</div>
</template>
<script>
export default {
data() {
return {
role: [{
name: 'Alex',
id: '1'
},
{
name: 'Sveta',
id: '2'
},
],
newRole: []
}
},
methods: {
addRow() {
this.role.forEach(function(value, key) {
this.newRole.push(value.id);
});
}
}
}
</script>