"add section" works

This commit is contained in:
Seth Ladygo
2019-05-17 16:04:35 -07:00
parent 7a23dcdf53
commit b9b91a9044
2 changed files with 24 additions and 3 deletions

View File

@ -26,7 +26,7 @@
:disabled="!valid"
color="primary"
flat
@click="show = false">OK</v-btn>
@click="doNewSection()">OK</v-btn>
<v-spacer></v-spacer>
</v-card-actions>
</v-card>
@ -37,8 +37,8 @@
<script>
import DialogHeading from './DialogHeading'
import { mapActions } from 'vuex'
// https://stackoverflow.com/questions/48035310/open-a-vuetify-dialog-from-a-component-template-in-vuejs
export default {
components: {
DialogHeading,
@ -59,7 +59,19 @@ export default {
this.$emit('input', value)
}
},
},
methods: {
...mapActions([
'newSection',
]),
doNewSection() {
if (this.name) {
this.newSection(this.name)
}
this.name = ''
this.show = false
}
},
}
</script>

View File

@ -284,6 +284,15 @@ export const store = new Vuex.Store({
// manipulation
//
newSection({ commit, getters }, name) {
let section = {
name: name,
id: getters.nextSectionID,
pages: [],
}
commit('addSection', section)
},
reorderSection({ commit }, payload) {
commit('reorderSection', payload)
},