I need to capitalize the input data of the model user.full_name. and if possible, should be written only in Latin letters
Vue js Uppercase
<p-input :value="value" @input="$emit('input', $event)" />
<UIFormInput
v-model="user.full_name "
class="w-full"
label="Full name"
/>
I have a lot of inputs. i need to uppercase some of them. more precisely the model is user.full_name. so I need help
You just need to change this.value. And with the help of the npm package dzcpy/transliteration, you can transform the input letters to their latin counterparts.
new Vue({
el: '#app',
template: `<input :value="value" @input="onChange" />`,
data() {
return {
value: ''
}
},
methods: {
onChange(evt) {
this.value = transliterate(evt.target.value.toUpperCase());
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script
async
defer
src="https://cdn.jsdelivr.net/npm/transliteration@2.1.8/dist/browser/bundle.umd.min.js"
></script>
<div id="app"></div>