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/has-permission.md.

HasPermission

此组件用于根据权限控制元素的显示与隐藏。

使用方式

<script lang="ts" setup>
import { VButton } from "@halo-dev/components";
</script>

<template>
  <HasPermission :permissions="['system:posts:manage']">
    <VButton type="danger">删除</VButton>
  </HasPermission>
</template>

Props

属性名类型默认值描述
permissionsstring[]无,必填定义组件所需的权限列表。