3๐
โ
If you want just change to uppercase easiest way is use style:
.uppercase{
text-transform: uppercase;
}
Also use filter can another choice:
filters: {
uppercase: function(v) {
return v.toUpperCase();
}
}
And if you want use directive as you use v-model got some problems so you can combine it with style solution:
Vue.directive("uppercase", {
bind(el, binding, vnode) {
el.style.textTransform = 'uppercase';
},
update(el, binding, vnode) {
el.style.textTransform = 'uppercase';
}
});
Here is simple codepen for directive for show all solutions
๐คMohsen
Source:stackexchange.com