Reputation: 703
I want to access to a ref define with an id
:ref="'modal' + item.id"
it give me modal123456 when I console log it
In my function I have :
function(item) {
console.log(this.$refs.modal + item)
// I want to have this.$refs.modal123456
}
how can I do it ?
Upvotes: 0
Views: 60
Reputation: 2060
You are appending item to value, you should append it to property name instead:
console.log(this.$refs[`modal${item.id}`])
Upvotes: 2