s12e161 arguments to custom directives
This commit is contained in:
parent
21a83d215c
commit
24bec745d1
@ -10,6 +10,7 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
|
||||
<h1>Custom Directives</h1>
|
||||
<p v-highlight:background='"red"'>Color This</p>
|
||||
<p v-highlight='"red"'>Color This</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,7 +3,12 @@ import App from './App.vue'
|
||||
|
||||
Vue.directive('highlight', {
|
||||
bind(el, binding, vnode){
|
||||
el.style.backgroundColor = binding.value;
|
||||
// el.style.backgroundColor = binding.value;
|
||||
if (binding.arg == "background"){
|
||||
el.style.backgroundColor = binding.value;
|
||||
} else {
|
||||
el.style.color = binding.value;
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user