I've been creating a simple directive and wanted to know how to put a value if the binding.value
is undefined
in a simpler way, much like the Vue Component where defalut value can be?
Example:
Vue.directive('color', {
bind: function (el, binding) {
var prop = binding.value,
color = prop.color
if(color == undefined) color = '#FFFFFF'
el.style.backgroundColor = color
}
})