how can i manipulate input value. Show hier is example
`https://jsfiddle.net/mbqjp4ax/`
if number greater than 5, number 9 should be entered. if I enter more than 5 it works fine but if I keep typing it will not work as expected.
You dont need to use getElementsByTagName and such things in vue. And $refs have a limited usage too. You should just use v-model.
Here your fiddle fixed
https://jsfiddle.net/pm9zwesr/
<v-text-field
label="Price"
v-model="price"
@input="up">
</v-text-field>
new Vue({
el: '#app',
data () {
return {
price: 123.45
}
},
methods: {
up (){
if (parseFloat(this.price) > 5) {
this.$nextTick(() => {
this.price = 9
})
}
},
reset () {
this.price = 0
}
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With