From 24bec745d15b5b3eac8b2a9397e574a6ca9495b2 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Fri, 20 Apr 2018 15:36:35 -0400 Subject: [PATCH] s12e161 arguments to custom directives --- s12/src/App.vue | 1 + s12/src/main.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/s12/src/App.vue b/s12/src/App.vue index ccaf6a9..8d30a73 100644 --- a/s12/src/App.vue +++ b/s12/src/App.vue @@ -10,6 +10,7 @@

Custom Directives

+

Color This

Color This

diff --git a/s12/src/main.js b/s12/src/main.js index 6b9961d..044dd6a 100644 --- a/s12/src/main.js +++ b/s12/src/main.js @@ -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; + } } })