Skip to content

Morph Popover ​

Vue 已实现 · 还原验收 0/1 · 上游演示 · 固定版本源码

预览 ​

用法 ​

vue
<script setup lang="ts">
import { PopoverMorph } from 'beui-vue'
import { ref } from 'vue'
const open = ref(false)
const actions = ['Edit','Duplicate','Share','Delete']
</script>
<template>
  <PopoverMorph v-model:open="open" label="Options">
    <template #trigger>Options ⌄</template>
    <template #default="{ close }"><div class="actions"><button v-for="action in actions" :key="action" type="button" @click="close">{{ action }}</button></div></template>
  </PopoverMorph>
</template>
<style scoped>.actions { width: 10rem; display: grid; } .actions button { text-align: start; padding: .4rem .5rem; border: none; background: none; color: var(--beui-foreground); cursor: pointer; border-radius: .4rem; } .actions button:hover { background: var(--beui-muted); }</style>

API ​

#trigger 定义触发器文字,默认插槽接收 close。v-model:open 控制从触发器边缘揭开的浮层。

上游变体 ​

还原验收 ​

基于 beUI 的独立 Vue 移植,依 MIT 许可证分发。