refactor: reset on leave
This commit is contained in:
parent
4f9ca4bd17
commit
458c1663bf
2 changed files with 7 additions and 1 deletions
|
|
@ -38,6 +38,10 @@ const emit = defineEmits([
|
||||||
'submit',
|
'submit',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reset,
|
||||||
|
})
|
||||||
|
|
||||||
function keydown(e: KeyboardEvent) {
|
function keydown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Escape' && props.open === true) {
|
if (e.key === 'Escape' && props.open === true) {
|
||||||
emit('update:open', false)
|
emit('update:open', false)
|
||||||
|
|
@ -63,7 +67,6 @@ function submit() {
|
||||||
keyword: props.keyword,
|
keyword: props.keyword,
|
||||||
category: props.category,
|
category: props.category,
|
||||||
})
|
})
|
||||||
emit('update:open', !open), reset()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const createKeyword = ((val, done) => {
|
const createKeyword = ((val, done) => {
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ const fileFormData = ref<{
|
||||||
const fileFormType = ref<'edit' | 'create'>('create')
|
const fileFormType = ref<'edit' | 'create'>('create')
|
||||||
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
|
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
|
||||||
const fileExistNotification = ref<boolean>(false)
|
const fileExistNotification = ref<boolean>(false)
|
||||||
|
const fileFormComponent = ref<InstanceType<typeof FileForm>>()
|
||||||
|
|
||||||
function triggerFolderDelete(pathname: string) {
|
function triggerFolderDelete(pathname: string) {
|
||||||
deleteFormType.value = 'deleteFolder'
|
deleteFormType.value = 'deleteFolder'
|
||||||
|
|
@ -176,6 +177,7 @@ async function submitFileForm(
|
||||||
fileFormData.value = {}
|
fileFormData.value = {}
|
||||||
fileFormState.value = false
|
fileFormState.value = false
|
||||||
currentParam.value = undefined
|
currentParam.value = undefined
|
||||||
|
fileFormComponent.value?.reset()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -379,6 +381,7 @@ async function submitFileForm(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<file-form
|
<file-form
|
||||||
|
ref="fileFormComponent"
|
||||||
:mode="fileFormType"
|
:mode="fileFormType"
|
||||||
:error="fileFormError"
|
:error="fileFormError"
|
||||||
v-model:open="fileFormState"
|
v-model:open="fileFormState"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue