Add way to hide save/cancel buttons for model-crud
This commit is contained in:
parent
0c247866c4
commit
a6555b7bae
|
@ -36,7 +36,7 @@
|
|||
Edit This
|
||||
</b-button>
|
||||
|
||||
<div v-if="mode == 'creating' || mode == 'editing'"
|
||||
<div v-if="showButtons"
|
||||
class="buttons">
|
||||
<b-button type="is-primary"
|
||||
:disabled="saveDisabled"
|
||||
|
@ -131,6 +131,10 @@ export default {
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
hideButtons: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
saveDisabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -144,6 +148,21 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
showButtons: function() {
|
||||
if (this.hideButtons) {
|
||||
return false
|
||||
}
|
||||
if (this.mode == 'creating') {
|
||||
return true
|
||||
}
|
||||
if (this.mode == 'editing') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
},
|
||||
|
||||
// TODO: why doesn't beforeRouteUpdate() work instead?
|
||||
// cf. https://router.vuejs.org/guide/essentials/dynamic-matching.html#reacting-to-params-changes
|
||||
watch: {
|
||||
|
|
Loading…
Reference in a new issue