2👍
Maybe you can try to use a computed property
in v-model
instead of an expression
.
<b-form-input id="amount_input" type="number"
v-model="reward_cents"
:state="reward_cents"/>
<script>
export default {
computed: {
reward_cents: {
get() {
return this.form.contract.reward_cents;
},
set(val) {
this.form.contract.reward_cents = Math.ceil(val / 100);
}
}
}
}
</script>
- [Vuejs]-Vue project – Uncaught TypeError: Cannot read properties of null (reading 'offsetWidth') error for a custom js script
- [Vuejs]-Problems with extracting params in nuxt 3
1👍
you can follow:
<b-form-input
id="amount_input"
type="number"
:value="form.contract.reward_cents"
v-model="reward_cents"
@change="OnChange"
:state="validate(form.contract.reward_cents)"/>
data(){
return: {
reward_cents: 0
}
}
methods: {
OnChange(newVal){
this.reward_cents = Math.ceil(newVal / 100);
}
}
- [Vuejs]-Calling Vue3 component methods from outside
- [Vuejs]-Component vue3 can't initialaize array data on created
Source:stackexchange.com