Vue
HTML
<div id="app">
<input id="testinput1" v-model="testval1" v-test />
<input id="testinput2" v-model="testval2" v-test />
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
Vue
Vue.directive('test', {
bind: (el) => {
console.log(el.id + " bound")
},
update: (el) => {
console.log(el.id + " updated")
}
})
new Vue({
el: "#app",
data: {
testval1: null,
testval2: null,
},
methods: {
}
})