For AI agents: the complete documentation index is available at https://docs.halo.run/llms.txt, the full documentation bundle is available at https://docs.halo.run/llms-full.txt, and this page is available as Markdown at https://docs.halo.run/developer-guide/plugin/api-reference/ui/components/filter-dropdown.md.

FilterDropdown

此组件为通用的下拉筛选组件,可以接收一个对象数组作为选项,并使用 v-model 绑定选择的值。

使用示例

<script lang="ts" setup>
import { ref } from "vue";

const value = ref("");
const items = [
  {
    label: "最近创建",
    value: "creationTimestamp,desc",
  },
  {
    label: "较晚创建",
    value: "creationTimestamp,asc",
  },
];
</script>
<template>
  <FilterDropdown v-model="value" label="排序" :items="items" />
</template>

Props

属性名类型默认值描述
items{ label: string; value?: string | boolean | number; }[]无,必填包含 label 和可选 value 的对象数组。
labelstring无,必填组件的标签文本。
modelValuestring | boolean | numberundefined可选,用于绑定到组件的值,可以是字符串、布尔值或数字。

Emits

事件名称参数描述
update:modelValuemodelValue: string | boolean | number | undefined当模型值更新时触发。