🌏 Translated with the assistance of DeepSeek and ChatGPT
PromptAction
Action controls for the Prompt toolbar: the action button PromptAction, the labeled switch PromptSwitch and the dropdown PromptSelect.
Basic Usage
Place the three controls in the toolbar slots of Prompt. PromptAction shows its text through label or the default slot, with the icon and suffix slots holding the icon and the trailing content; PromptSwitch controls its active state with v-model and shows a close entry while it is active; PromptSelect takes its options from options and keeps the selected value in v-model. All three are disabled together with the disabled and readonly states of the Prompt.
Ask anything
Hide source code
API
PromptActionProps
| Attribute | Type | Optional | Default | Description | Version |
|---|---|---|---|---|---|
| label | string | True | | The text of PromptAction. | 0.2.1 |
| disabled | boolean | True | false | Whether PromptAction is disabled. | 0.2.1 |
PromptActionSlots
| Slot | Parameter | Description | Version |
|---|---|---|---|
| default | | The text content of PromptAction. | 0.2.1 |
| icon | | The icon of PromptAction. | 0.2.1 |
| suffix | | The trailing content of PromptAction. | 0.2.1 |
PromptSwitchProps
| Attribute | Type | Optional | Default | Description | Version |
|---|---|---|---|---|---|
| label | string | True | | The text of PromptSwitch. | 0.2.1 |
| disabled | boolean | True | false | Whether PromptSwitch is disabled. | 0.2.1 |
| modelValue | boolean | True | false | The active state in controlled mode. | 0.2.1 |
| defaultValue | boolean | True | false | The initial active state in uncontrolled mode. | 0.2.1 |
| showClose | boolean | True | true | Whether the close entry is shown while it is active. | 0.2.1 |
PromptSwitchEvents
| Event | Parameter | Description | Version |
|---|---|---|---|
| update:modelValue | value: boolean | Triggered when the active state changes. | 0.2.1 |
PromptSwitchSlots
| Slot | Parameter | Description | Version |
|---|---|---|---|
| default | | The text content of PromptSwitch. | 0.2.1 |
| icon | | The icon of PromptSwitch. | 0.2.1 |
PromptSelectProps
| Attribute | Type | Optional | Default | Description | Version |
|---|---|---|---|---|---|
| disabled | boolean | True | false | Whether PromptSelect is disabled. | 0.2.1 |
| options | (string | PromptSelectOption | PromptSelectGroupOption)[] | True | | The data of the dropdown list. | 0.2.1 |
| modelValue | any | True | | The selected value in controlled mode. | 0.2.1 |
| defaultValue | any | True | | The initial selected value in uncontrolled mode. | 0.2.1 |
| caretDuration | number | True | 250 | The duration of the animation of the dropdown caret. | 0.2.1 |
| dropdownProps | Omit<PopupProps, 'visible' | 'defaultVisible' | 'content'> & EmitEvent<PopupEvents> | True | | The properties and events of the dropdown popup. | 0.2.1 |
PromptSelectEvents
| Event | Parameter | Description | Version |
|---|---|---|---|
| update:modelValue | value: any | Triggered when the selected value changes. | 0.2.1 |
| open | e: MouseEvent | Triggered when the dropdown list opens. | 0.2.1 |
| close | e: MouseEvent | TouchEvent | KeyboardEvent | Triggered when the dropdown list closes. | 0.2.1 |
| select | value: any, option: string | PromptSelectOption, e: MouseEvent | Triggered when an option is chosen from the dropdown list. | 0.2.1 |
PromptSelectSlots
| Slot | Parameter | Description | Version |
|---|---|---|---|
| default | | The text content of PromptSelect. | 0.2.1 |
| icon | | The icon of PromptSelect. | 0.2.1 |
| option | option: string | PromptSelectOption | The content of an option in the dropdown list. | 0.2.1 |
| group-label | option: PromptSelectGroupOption | The content of a group label in the dropdown list. | 0.2.1 |
PromptSelectExpose
| Attribute | Type | Optional | Default | Description | Version |
|---|---|---|---|---|---|
| open | () => void | False | | Opens the dropdown list. | 0.2.1 |
| close | () => void | False | | Closes the dropdown list. | 0.2.1 |
PromptSelectOption
ts
export interface PromptSelectOption extends OptionListOption {}
export interface PromptSelectGroupOption extends OptionListGroupOption {
children: (PromptSelectOption | string)[]
}OptionListOption, OptionListOption
ts
export interface OptionListOption<T = any> extends Option<T> {
disabled?: boolean
key?: string | number | symbol
}
export interface OptionListGroupOption extends GroupOption {
label: string
key: string | number | symbol
children: (OptionListOption | string)[]
}Option, GroupOption
ts
export interface Option<T = any> {
value: T
label: string
}
export interface GroupOption<T = any> {
children: (Option<T> | string)[]
type: 'group'
}EmitEvent
ts
export type EmitEvent<T extends Record<string, any>> = {
[K in keyof T as `on${Capitalize<K & string>}`]?: (...args: T[K]) => void
}RestAttrs
ts
import type { StyleValue } from 'vue'
export type VueClassValue = string | Record<string, any> | VueClassValue[]
export type VueStyleValue = StyleValue
export type RestAttrs = {
style?: VueStyleValue | null
class?: VueClassValue | null
[x: string]: any
}