Ver código fonte

auto save default options and remove save button

pull/342/head
Guillaume Vincent 7 anos atrás
pai
commit
ae96c6f522
1 arquivos alterados com 15 adições e 21 exclusões
  1. +15
    -21
      src/views/ConfigureOptions.vue

+ 15
- 21
src/views/ConfigureOptions.vue Ver arquivo

@@ -1,17 +1,21 @@
<template>
<div>
<h4>Default Options</h4>
<small class="help-text">default options are saved locally</small>
<div class="form-group">
<input id="login"
name="login"
type="text"
class="form-control"
placeholder="Login"
autocomplete="off"
autocorrect="off"
autocapitalize="none"
v-model="defaultPassword.login">
</div>
<options v-bind:password="defaultPassword" v-on:optionsUpdated="updatePassword"></options>
<div class="form-group">
<button type="button" class="btn btn-primary" v-on:click="saveDefault">
<span v-if="optionsSaved">
<i class="fa fa-check" aria-hidden="true"></i> saved
</span>
<span v-else>
Save
</span>
</button>
<div class="alert alert-info" role="alert">
Default options are saved <strong>locally</strong></small>
</div>
</div>
</div>
</template>
@@ -28,22 +32,12 @@
computed: mapGetters(['defaultPassword']),
data(){
return {
options: null,
optionsSaved: false
}
},
methods: {
saveDefault(){
if (this.options !== null) {
this.$store.dispatch('saveDefaultPassword', {password: this.options});
}
this.optionsSaved = true;
setTimeout(() => {
this.optionsSaved = false;
}, 3000);
},
updatePassword(password){
this.options = password;
this.$store.dispatch('saveDefaultPassword', {password});
}
}
}


Carregando…
Cancelar
Salvar