forked from TencentBlueKing/blueking-dbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): 全站搜索优化 TencentBlueKing#7951
- Loading branch information
Showing
15 changed files
with
435 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
dbm-ui/frontend/src/components/system-search/components/FilterTypeSelect.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<template> | ||
<BkSelect | ||
v-model="modelValue" | ||
:filterable="false" | ||
@change="handleChooseType" | ||
@toggle="handleTogglePopover"> | ||
<template #trigger> | ||
<div :class="triggerClassName"> | ||
<span class="label-content"> | ||
<BkButton | ||
class="mr-4" | ||
:style="{ color: titleColor }" | ||
text> | ||
{{ currentTitle }} | ||
</BkButton> | ||
<DbIcon | ||
class="more-icon" | ||
:class="{ | ||
'more-icon-active': isRotate, | ||
}" | ||
:type="iconType" /> | ||
</span> | ||
</div> | ||
</template> | ||
<BkOption | ||
v-for="item in dropdownList" | ||
:id="item.value" | ||
:key="item.value" | ||
:name="item.label" /> | ||
</BkSelect> | ||
</template> | ||
|
||
<script lang="ts"> | ||
export enum FilterType { | ||
EXACT = 'EXACT', | ||
CONTAINS = 'CONTAINS', | ||
} | ||
</script> | ||
<script setup lang="ts"> | ||
import { useI18n } from 'vue-i18n'; | ||
interface Props { | ||
titleColor: string; | ||
iconType: string; | ||
triggerClassName: string; | ||
} | ||
defineProps<Props>(); | ||
const modelValue = defineModel<string>({ | ||
required: true, | ||
}); | ||
const { t } = useI18n(); | ||
const dropdownList = [ | ||
{ | ||
label: t('精确搜索'), | ||
value: FilterType.EXACT, | ||
}, | ||
{ | ||
label: t('模糊搜索'), | ||
value: FilterType.CONTAINS, | ||
}, | ||
]; | ||
const isRotate = ref(false); | ||
const currentTitle = computed(() => | ||
modelValue.value === FilterType.EXACT ? dropdownList[0].label : dropdownList[1].label, | ||
); | ||
const handleChooseType = (type: string) => { | ||
modelValue.value = type; | ||
}; | ||
const handleTogglePopover = (isShow: boolean) => { | ||
isRotate.value = isShow; | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.