From 33a5099b40259792bd4307d3bf122d1acd874784 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Fri, 24 Feb 2023 14:16:25 +0800 Subject: [PATCH] fix: the issue that the useSlugify hook may cause the value to be undefined --- src/composables/use-slugify.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/composables/use-slugify.ts b/src/composables/use-slugify.ts index 1a47228d..fb727da1 100644 --- a/src/composables/use-slugify.ts +++ b/src/composables/use-slugify.ts @@ -15,6 +15,9 @@ export default function useSlugify( ); const handleGenerateSlug = () => { + if (!source.value) { + return; + } target.value = slugify(source.value, { trim: true, });