fix place update
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
v-card-actions
|
v-card-actions
|
||||||
v-spacer
|
v-spacer
|
||||||
v-btn(@click='dialog=false' color='warning') {{$t('common.cancel')}}
|
v-btn(@click='dialog=false' color='warning') {{$t('common.cancel')}}
|
||||||
v-btn(@click='savePlace' color='primary') {{$t('common.save')}}
|
v-btn(@click='savePlace' color='primary' :loading='loading' :disable='loading') {{$t('common.save')}}
|
||||||
|
|
||||||
v-card-text
|
v-card-text
|
||||||
v-data-table(
|
v-data-table(
|
||||||
@@ -33,10 +33,11 @@
|
|||||||
v-icon mdi-pencil
|
v-icon mdi-pencil
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState, mapActions } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
loading: false,
|
||||||
dialog: false,
|
dialog: false,
|
||||||
place: { name: '', address: '', id: null },
|
place: { name: '', address: '', id: null },
|
||||||
headers: [
|
headers: [
|
||||||
@@ -48,20 +49,18 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: mapState(['places']),
|
computed: mapState(['places']),
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(['updateMeta']),
|
||||||
editPlace (item) {
|
editPlace (item) {
|
||||||
console.error(item)
|
|
||||||
// if (items.length === 0) {
|
|
||||||
// this.place.name = this.place.address = ''
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// const item = items[0]
|
|
||||||
this.place.name = item.name
|
this.place.name = item.name
|
||||||
this.place.address = item.address
|
this.place.address = item.address
|
||||||
this.place.id = item.id
|
this.place.id = item.id
|
||||||
this.dialog = true
|
this.dialog = true
|
||||||
},
|
},
|
||||||
async savePlace () {
|
async savePlace () {
|
||||||
|
this.loading = true
|
||||||
await this.$axios.$put('/place', this.place)
|
await this.$axios.$put('/place', this.place)
|
||||||
|
this.updateMeta()
|
||||||
|
this.loading = false
|
||||||
this.dialog = false
|
this.dialog = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user