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',
|
||||
])
|
||||
|
||||
defineExpose({
|
||||
reset,
|
||||
})
|
||||
|
||||
function keydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape' && props.open === true) {
|
||||
emit('update:open', false)
|
||||
|
|
@ -63,7 +67,6 @@ function submit() {
|
|||
keyword: props.keyword,
|
||||
category: props.category,
|
||||
})
|
||||
emit('update:open', !open), reset()
|
||||
}
|
||||
|
||||
const createKeyword = ((val, done) => {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ const fileFormData = ref<{
|
|||
const fileFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
|
||||
const fileExistNotification = ref<boolean>(false)
|
||||
const fileFormComponent = ref<InstanceType<typeof FileForm>>()
|
||||
|
||||
function triggerFolderDelete(pathname: string) {
|
||||
deleteFormType.value = 'deleteFolder'
|
||||
|
|
@ -176,6 +177,7 @@ async function submitFileForm(
|
|||
fileFormData.value = {}
|
||||
fileFormState.value = false
|
||||
currentParam.value = undefined
|
||||
fileFormComponent.value?.reset()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -379,6 +381,7 @@ async function submitFileForm(
|
|||
</div>
|
||||
|
||||
<file-form
|
||||
ref="fileFormComponent"
|
||||
:mode="fileFormType"
|
||||
:error="fileFormError"
|
||||
v-model:open="fileFormState"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue