diff --git a/src/views/components/ConditionTags.vue b/src/views/components/ConditionTags.vue index 16eadf00..9c305445 100644 --- a/src/views/components/ConditionTags.vue +++ b/src/views/components/ConditionTags.vue @@ -38,23 +38,21 @@ limitations under the License. --> size="small" v-model="tags" class="trace-new-tag" - @change="addLabels" :placeholder="t('addTags')" @click="showClick" + :autofocus="true" /> @@ -94,12 +92,13 @@ const theme = ref("dark"); const tags = ref(""); const tagsList = ref([]); const tagArr = ref([]); +const tagKeys = ref([]); const tipsMap = { LOG: "logTagsTip", TRACE: "traceTagsTip", ALARM: "alarmTagsTip", }; -const dropdown1 = ref(); +const dropdownTag = ref(); fetchTagKeys(); function removeTags(index: number) { @@ -132,6 +131,7 @@ async function fetchTagKeys() { return; } tagArr.value = resp.data.tagKeys; + tagKeys.value = resp.data.tagKeys; } async function fetchTagValues() { @@ -147,18 +147,18 @@ async function fetchTagValues() { function selectTag(item: string) { if (tags.value.includes("=")) { - tags.value = tags.value + item; - fetchTagValues(); - } else { - tags.value = item + "="; + tags.value += item; + addLabels(); + tagArr.value = tagKeys.value; + return; } + tags.value = item + "="; + fetchTagValues(); + dropdownTag.value.handleOpen(); } function showClick() { - dropdown1.value.handleOpen(); - if (tags.value.includes("=")) { - fetchTagValues(); - } + dropdownTag.value.handleOpen(); }