VButton
VButton wraps Element Plus ElButton and adds optional confirmation flows, tooltip wrapping, automatic loading helpers, and leading-edge click debounce.
Basic Usage
Use auto-loading to keep the button in loading state until the handler calls done() after an async save finishes.
Confirmation
Compare popconfirm for inline confirmation with boxconfirm for dialog-style interruption.
Tooltip
Use tip-content for quick hints, and tip-config when you need to customize tooltip placement or theme.
Complete example
Combine async loading, debounce, tooltip wrapping, and boxconfirm callbacks in a toolbar-style layout.
Behavior Notes
clickandconfirmboth receive adone()callback. Call it to stop the internal loading states started byauto-loadingorauto-full-screen-loading.- When
confirm-typeis'popconfirm', clicking the button only opens the confirmation popup. The action itself runs after theconfirmevent fires. - When
confirm-typeis'boxconfirm', clicking the button opensElMessageBox.confirm, andcancelis emitted when the dialog is dismissed. debounceacceptstrueor a number.trueuses a 500 ms leading debounce, while a number sets the debounce delay in milliseconds.- When
tip-contentis provided,tip-configis merged on top of{ effect: 'dark', placement: 'top', content: tipContent }. tip-contenttakes precedence overconfirm-type="popconfirm"because only one wrapper component is rendered. If you need both tooltip and confirmation, useboxconfirm.- Additional attributes such as
size,disabled,plain, andiconare forwarded to the innerElButton. as-el-buttononly controls the outerv-buttonwrapper class used by the extended button spacing styles.
API
VButton Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| as-el-button | apply the outer v-button wrapper class for extended spacing styles | boolean | true |
| auto-loading | automatically set the inner button loading state before emitting click or confirm | boolean | false |
| auto-full-screen-loading | show a fullscreen loading mask before emitting click or confirm | boolean | false |
| confirm-type | confirmation mode used before running the action | enum | null |
| box-config | boxconfirm dialog options; currently uses message, title, confirmButtonText, cancelButtonText, and type | object | {} |
| pop-config | props forwarded to ElPopconfirm when confirm-type="popconfirm" | object | { title: '确定删除吗?' } |
| type | button type forwarded to ElButton | enum | null |
| tip-content | tooltip text content | string | null |
| tip-config | props merged into the tooltip config | object | null |
| loading | manual loading state for the inner button | boolean | false |
| debounce | enable leading click debounce, or provide the debounce delay in milliseconds | boolean / number | false |
box-configfalls back tomessage: '此操作将永久删除该数据, 是否继续?',title: '提示',confirmButtonText: '确定',cancelButtonText: '取消', andtype: 'warning'.
VButton Events
| Name | Description | Type |
|---|---|---|
| click | emitted when the button action runs without confirmation | function |
| confirm | emitted after the user accepts a popconfirm or boxconfirm action | function |
| cancel | emitted when a confirmation flow is dismissed | function |
clickis only emitted whenconfirm-typeis not set. Confirmation flows useconfirminstead.
VButton Slots
| Name | Description |
|---|---|
| default | button content |