On the third day of my suffering, I seek your help. Can you please guide me on how to save text input in "store" in vuex.js and then add it to the value of the same input itself?
I've attempted it like this but seem to be making a mistake somewhere.
HTML
<f7-list-input
label="Username"
name="username"
placeholder="Username"
type="text"
:value="newUserName"
@input="username = $event.target.value"
required validate
pattern="[3-9a-zA-Zа-яА-ЯёЁ]+"
v-model="saveUserName"
/>
SCRIPT
export default {
data() {
return {
username: '',
password: '',
};
},
methods: {
signIn() {
const self = this;
const app = self.$f7;
const router = self.$f7router;
router.back();
app.dialog.alert(`Username: ${self.username}<br>Password: ${self.password}`, () => {
router.back();
});
},
saveUserName(){
this.$store.commit(saveName);
}
},
computed:{
userName(){
return this.$store.state.newUserName;
}
}
};
STORE
export default new Vuex.Store({
state:{
userNameStor: 'newUserName',
userPasswordStor:''
},
mutations:{
saveName(state){
userNameStor:newUserName;
return newUserName;
}
}
});