Expandable Control
Vue 已实现 · 还原验收 0/1 · 上游演示 · 固定版本源码
预览
用法
vue
<script setup lang="ts">
import { ref } from 'vue'
import { ExpandableControl } from 'beui-vue'
const tags = ref(['Design','Motion'])
function add() { if (!tags.value.includes('New tag')) tags.value.push('New tag') }
</script>
<template><div class="tags"><ExpandableControl label="Add tag" @activate="add"/><ExpandableControl v-for="tag in tags" :key="tag" :label="tag" :action-label="`Remove ${tag}`" variant="chip" @remove="tags=tags.filter(value => value!==tag)" /></div></template>
<style scoped>.tags { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }</style>API
variant 可为 button 或 chip。使用 label、actionLabel、icon 插槽配置内容。触发 activate 或 remove。