2-13 vueカスタム命令伝値
1018 ワード
カスタムコマンド値
sk666
sk666
//
// :vue , : v-
// : value
Vue.directive('red', {
bind:function (el, val) {
console.log(val);
// el.style.background = val.value;
el.style.background = val.value.color;
}
});
var vm = new Vue({
el:'#app',
data:{
msg:'hello',
//skcolor:'yellow'
}
});
// , directives
var vm2 = new Vue({
el:'#app2',
directives:{
// : : {}
skblue:{
bind:function (el, val) {
el.style.background = val.value.color
}
}
}
})