Today I Learned - Rocky Kev

TIL Vue3 has modifiers built in for input forms

POSTED ON:

TAGS:

Within a Input, you can force the type to be a number. Take a look -> v-model.number

    <input v-model.number="num2" type="text" />

This is often useful when the input type is text. If the input type is number, Vue can automatically convert the raw string value to a number, and you don't need to add the .number modifier to v-model. If the value cannot be parsed with parseFloat(), then the original value is returned.

Form Modifiers


Related TILs

Tagged:

TIL How to implement two-way binding without a framework

One of the reasons we use React or Vue is because of that sweet sweet two-way binding. It's the automatic syncing of data between the model (data) and the view (UI) in both directions. Any changes made to the data will automatically update the view, and any changes made to the view will automatically update the data.

TIL Cherry-picking out of bootstrap-vue

If you are using a component library that uses ES modules like bootstrap-vue, you can cherry pick its components instead of just registering all of them globally.

TIL how Svelte is different fom Vue/React