I have a simple Vue form component, it has some text inputs:
<input type="text" class="form-control" v-model="amount">
This text input has the following default value:
mounted() {
this.$store.commit('refreshBalance')
},
data() {
return {
amount: this.$store.getters.baseBalance,
};
},
The problem with my code is that the value of amount
is always the same, it doesn't change if i change the value of that Vuex store.
So, for example, if when i open the page this.$store.getters.baseBalance
is equal to 10 and i change it to 20, the default value of that input field will always be 10. Is there any way i can make it reactive? Thanks in advance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…