fix: check fileName2long? & close after submit

This commit is contained in:
puri-ph4tt 2023-11-30 16:47:29 +07:00
parent bb59390063
commit 0511d4285f
4 changed files with 36 additions and 13 deletions

View file

@ -30,6 +30,7 @@ const {
updateFile,
deleteFile,
checkFile,
checkFileName,
} = useTreeDataStore()
const currentIcon = computed(() =>
@ -60,7 +61,7 @@ const fileFormData = ref<{
category?: string
}>({})
const fileFormType = ref<'edit' | 'create'>('create')
const fileFormError = ref<{ fileExist?: boolean }>({})
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
const fileExistNotification = ref<boolean>(false)
function triggerFolderDelete(pathname: string) {
@ -368,7 +369,12 @@ async function submitFileForm(
v-model:description="fileFormData.description"
v-model:keyword="fileFormData.keyword"
v-model:category="fileFormData.category"
@filechange="(name: string) => (fileFormError.fileExist = checkFile(name))"
@filechange="
(name: string) => (
(fileFormError.fileExist = checkFile(name)),
(fileFormError.fileName2Long = checkFileName(name))
)
"
@submit="submitFileForm"
/>