0π
I recomend you use a filter but not in de same input maybe you can put the result on inches after than input.
<input v-model="number">
<label>{{ number | inches }}</label>
Regards!
0π
Itβs finally working.
Vue.component('v-unit-input', {
template:
'<v-text-field ref="textfield" :label="label" suffix="mm" :value="to_mm" @input="toInch($event)" v-bind="$attrs" "></v-text-field>',
props: {
value: Number,
label: String,
},
computed: {
to_mm(){
const mm = Math.round(this.value * 25.4);
return mm
},
},
methods: {
toInch: function (val) {
if (val !== '-') {
const result = val / 25.4;
this.$emit('input', result)
}
}
}
})
- [Vuejs]-Rendering escaped HTML from api call with vue.js
- [Vuejs]-Vue installing but -v and create not working
Source:stackexchange.com