From 51f63b4a2ae6561311084dce617514acd24cca78 Mon Sep 17 00:00:00 2001 From: terwer Date: Sun, 6 Aug 2023 11:26:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E7=9A=84postid=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/publish/SinglePublishSelectPlatform.vue | 2 +- src/composables/usePublish.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/publish/SinglePublishSelectPlatform.vue b/src/components/publish/SinglePublishSelectPlatform.vue index 5d4d942e..371dd279 100644 --- a/src/components/publish/SinglePublishSelectPlatform.vue +++ b/src/components/publish/SinglePublishSelectPlatform.vue @@ -72,7 +72,7 @@ const handleSingleDoPublish = (key: string) => { const checkHasPublished = (key: string) => { const postidKey = getDynPostidKey(key) - const postMetaValue = formData.postMeta[postidKey] + const postMetaValue = formData.postMeta.hasOwnProperty(postidKey) ? formData.postMeta[postidKey] : undefined return !StrUtil.isEmptyString(postMetaValue) } diff --git a/src/composables/usePublish.ts b/src/composables/usePublish.ts index 146dd1fd..f893b29d 100644 --- a/src/composables/usePublish.ts +++ b/src/composables/usePublish.ts @@ -96,7 +96,8 @@ const usePublish = () => { throw new Error("配置错误,posidKey不能为空,请检查配置") } const postMeta = singleFormData.setting[id] ?? {} - singleFormData.postid = postMeta[posidKey] ?? "" + const postMetaValue = postMeta.hasOwnProperty(posidKey) ? postMeta[posidKey] : undefined + singleFormData.postid = postMetaValue ?? "" } singleFormData.isAdd = StrUtil.isEmptyString(singleFormData.postid) @@ -180,7 +181,9 @@ const usePublish = () => { if (singleFormData.publishProcessStatus) { const postMeta = singleFormData.setting[id] ?? {} const updatedPostMeta = { ...postMeta } - delete updatedPostMeta[posidKey] + if (updatedPostMeta.hasOwnProperty(posidKey)) { + delete updatedPostMeta[posidKey] + } singleFormData.setting[id] = updatedPostMeta await updateSetting(singleFormData.setting)