Allow for discarding of changes without leaving (#9644)

* Allow for discarding of changes without leaving

* Update to use v-if for consistency

* Fix boolean logic

* Allow disabling of options

* Remove unused disabled prop
This commit is contained in:
ian
2021-11-09 23:09:11 +08:00
committed by GitHub
parent c962144cef
commit 14a5347eca
5 changed files with 45 additions and 10 deletions

View File

@@ -89,6 +89,7 @@
@save-and-stay="saveAndStay"
@save-and-add-new="saveAndAddNew"
@save-as-copy="saveAsCopyAndNavigate"
@discard-and-stay="discardAndStay"
/>
</template>
</v-button>
@@ -343,6 +344,7 @@ export default defineComponent({
saveAndStay,
saveAndAddNew,
saveAsCopyAndNavigate,
discardAndStay,
isBatch,
revisionsDrawerDetail,
previewLoading,
@@ -492,9 +494,15 @@ export default defineComponent({
function discardAndLeave() {
if (!leaveTo.value) return;
edits.value = {};
confirmLeave.value = false;
router.push(leaveTo.value);
}
function discardAndStay() {
edits.value = {};
confirmLeave.value = false;
}
async function toggleArchive() {
await archive();