diff --git a/src/modules/contents/posts/categories/components/CategoryEditingModal.vue b/src/modules/contents/posts/categories/components/CategoryEditingModal.vue
index 0433a3ed..a377ef35 100644
--- a/src/modules/contents/posts/categories/components/CategoryEditingModal.vue
+++ b/src/modules/contents/posts/categories/components/CategoryEditingModal.vue
@@ -88,6 +88,12 @@ const onVisibleChange = (visible: boolean) => {
}
};
+const handleResetForm = () => {
+ formState.value = cloneDeep(initialFormState);
+ formState.value.metadata.name = uuid();
+ reset("category-form");
+};
+
const { Command_Enter } = useMagicKeys();
watchEffect(() => {
@@ -99,13 +105,20 @@ watchEffect(() => {
watch(
() => props.visible,
(visible) => {
- if (visible && props.category) {
- formState.value = cloneDeep(props.category);
- return;
+ if (!visible) {
+ handleResetForm();
+ }
+ }
+);
+
+watch(
+ () => props.category,
+ (category) => {
+ if (category) {
+ formState.value = cloneDeep(category);
+ } else {
+ handleResetForm();
}
- formState.value = cloneDeep(initialFormState);
- reset("category-form");
- formState.value.metadata.name = uuid();
}
);
diff --git a/src/modules/contents/posts/categories/components/CategoryListItem.vue b/src/modules/contents/posts/categories/components/CategoryListItem.vue
index eab5d0fa..647d30dc 100644
--- a/src/modules/contents/posts/categories/components/CategoryListItem.vue
+++ b/src/modules/contents/posts/categories/components/CategoryListItem.vue
@@ -88,7 +88,9 @@ function onDelete(category: CategoryTree) {
删除中
+
20 篇文章
diff --git a/src/modules/contents/posts/components/PostSettingModal.vue b/src/modules/contents/posts/components/PostSettingModal.vue
index 92795cbd..829b733e 100644
--- a/src/modules/contents/posts/components/PostSettingModal.vue
+++ b/src/modules/contents/posts/components/PostSettingModal.vue
@@ -1,6 +1,6 @@