Reputation: 5638
So I want to bind style using a directive since I need to test a value send to the element.
<div v-portrait="photo.portrait"></div>
The thing is I need to access a data()
of my component but I don't get how since this
is out of scope.
directives: {
portrait: {
bind: function (el, binding) {
if(binding.value == true){
console.log(this); //undefined
el.height = (this.rowHeight)+ 'px';
}
}
}
}
So how could I retrieve this.rowHeight
?
Upvotes: 0
Views: 30