remember last box

This commit is contained in:
j3d1 2019-12-29 17:04:03 +01:00
parent 7141c8e34e
commit ca38616395
3 changed files with 12 additions and 4 deletions

View file

@ -23,6 +23,9 @@ export default {
data: () => ({
item: {}
}),
created() {
this.item = {box: this.$store.state.lastUsed.box || ''};
},
methods: {
saveNewItem() {
this.$store.dispatch('postItem', this.item);

View file

@ -53,7 +53,7 @@ export default {
sortedOptions: ({options, nameKey}) => options.sort((a, b) => a[nameKey].localeCompare(b[nameKey], 'en', { numeric: true })),
},
watch: {
internalName(newValue, oldValue) {
internalName(newValue) {
if (this.isValid) {
if(!this.selectedOption || newValue!=this.selectedOption[this.nameKey]){
this.selectedOption = this.options.filter(e => e[this.nameKey] === newValue)[0];
@ -61,7 +61,6 @@ export default {
this.model[this.nameKey] = this.selectedOption[this.nameKey];
this.model[this.uniqueKey] = this.selectedOption[this.uniqueKey];
}
console.log(oldValue, newValue, this.isValid);
}
},
methods: {