"add section" works
This commit is contained in:
@ -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>
|
||||
|
||||
|
||||
@ -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)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user