Browse Source

修正关键词变量类型及处理

zachary.zeng 2 years ago
parent
commit
430786d091
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/views/report/components/ChapterEditor.vue

+ 3 - 3
src/views/report/components/ChapterEditor.vue

@@ -25,7 +25,7 @@ const titleEditor = ref<HTMLInputElement | null>(null);
 
 const titleEditing = ref(false);
 
-const keywordsInChapter = ref<string[]>([])
+const keywordsInChapter = ref('')
 
 const keywordsEditor = ref<HTMLInputElement | null>(null);
 
@@ -67,7 +67,7 @@ function onTitleChange() {
 
 function onKeywordsChange() {
   keywordsEditing.value = false;
-  emits("change", {...props.data, keywords: keywordsInChapter.value})
+  emits("change", {...props.data, keywords: keywordsInChapter.value.split(",")})
 }
 
 function onTitleChangeCancel() {
@@ -76,7 +76,7 @@ function onTitleChangeCancel() {
 }
 
 function onKeywordsChangeCancel(){ 
-  keywordsInChapter.value = props.data.keywords;
+  keywordsInChapter.value = props.data.keywords.join(",");
   keywordsEditing.value = false;
 }