Answer the question
In order to leave comments, you need to log in
Change value in input on click?
Store:
export default {
actions:{
addNumber(ctx){
const number=[32,35]
ctx.commit('allNumber',number)
}
},
mutations:{
allNumber(state,number){
state.numbers = number
}
},
state:{
numbers:[],
change:[]
},
getters:{
number(state){
return state.numbers
},
}
}
<div>
<input type="text" class="first" value="num" >
<input type="text" class="second">=
<input type="text" class="third"><br>
<div v-for="num in number">
<button>{{num}}</button>
</div>
</div>
import {mapGetters,mapActions} from 'vuex'
export default {
name: 'App',
computed:mapGetters(['number']),
methods: {
...mapActions(["addNumber"]),
},
async mounted() {
this.addNumber()
},
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question