Vue BlockUI 컴포넌트
BlockUI는 특정 컴포넌트나 페이지 전체를 가릴 수 있는 컴포넌트예요. 처리 중인 영역에 마스크를 덮어 사용자 조작을 잠시 막을 때 사용해요.
출처: 문서
본문
Vue BlockUI Component
BlockUI can either block other components or the whole page.
Import
import BlockUI from 'primevue/blockui';
Accessibility
Screen Reader BlockUI는 UI가 가려지고 해제될 때 aria-busy 상태 속성을 관리해요. 모든 유효한 속성은 루트 요소로 전달되기 때문에, role과 aria-live 같은 추가 속성으로 라이브 영역(live regions)을 정의할 수도 있어요. Keyboard Support 이 컴포넌트에는 인터랙티브 요소가 없어요.
Basic
가릴 요소는 BlockUI의 자식으로 배치하고, 상태를 제어하려면 blocked 프로퍼티가 필요해요.
<div class="mb-4">
<Button label="Block" @click="blocked = true" class="me-2" severity="secondary"></Button>
<Button label="Unblock" @click="blocked = false" severity="secondary"></Button>
</div>
<BlockUI :blocked="blocked">
<Panel header="Basic">
<p class="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</Panel>
</BlockUI>
Document
fullScreen 프로퍼티를 활성화하면 문서 전체를 제어해요.
<BlockUI :blocked="blocked" fullScreen />
<Button label="Block" @click="blocked = true" />
Composition API Example
<template>
<div class="card">
<BlockUI :blocked="blocked" fullScreen />
<Button label="Block" @click="blockDocument" />
</div>
</template>
<script setup>
import { ref } from "vue";
const blocked = ref(false);
const blockDocument = () => {
blocked.value = true;
setTimeout(() => {
blocked.value = false;
}, 3000);
}
<\/script>
Block U I
Props
| Name | Type | Default | Description |
|---|---|---|---|
| blocked | boolean | false | Controls the blocked state. |
| fullScreen | boolean | false | When enabled, the whole document gets blocked. |
| baseZIndex | number | 0 | Base zIndex value to use in layering. |
| autoZIndex | boolean | true | Whether to automatically manage layering. |
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
| pt | PassThrough | - | Used to pass attributes to DOM elements inside the component. |
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
Pass Through Options
| Name | Type | Description |
|---|---|---|
| root | BlockUIPassThroughOptionType | Used to pass attributes to the root's DOM element. |
| mask | BlockUIPassThroughOptionType | Used to pass attributes to the mask's DOM element. |
| hooks | any | Used to manage all lifecycle hooks. |
Theming
CSS Classes
| Class | Description |
|---|---|
| p-blockui | Class name of the root element |
Design Tokens
| Token | CSS Variable | Description |
|---|---|---|
| blockui.border.radius | --p-blockui-border-radius | Border radius of root |