-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66497fd
commit fdd0af4
Showing
15 changed files
with
402 additions
and
151 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 { | ||
CONTAINS = 'CONTAINS', | ||
EXACT = 'EXACT', | ||
} | ||
</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.CONTAINS, | ||
}, | ||
{ | ||
label: t('精确搜索'), | ||
value: FilterType.EXACT, | ||
}, | ||
]; | ||
const isRotate = ref(false); | ||
const currentTitle = computed(() => | ||
modelValue.value === 'CONTAINS' ? 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.