Introduction
XSender is a component with built-in smart conversation features including input, tag selection, command popup, user mention, and other scenarios.
📌 Warning
The plugin version must be greater than 1.3.98. The previous version was named EditorSender, and there are significant API differences. Please take note.
Code Examples
Basic Usage
Placeholder
Auto Focus
Status
Submit Type
Layout Variant
Custom Action List
Custom Prefix
Custom Header
💯 欢迎使用 Element Plus X
🦜 自定义头部内容
Custom Footer
Custom Input Style
Max Length
当前输入长度: / 200
Advanced Usage
Input
Tag Selection
User Mention
Command Trigger
Prefix Tip
前置标签状态:
Properties
Props
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
placeholder | string | false | 请输入内容 | Placeholder text |
device | PC | H5 | auto | false | auto | Interaction device |
autoFocus | boolean | false | false | Auto focus after render |
variant | default | updown | false | default | Layout variant |
maxLength | number | false | -1 | Input length limit |
submitType | enter | shiftEnter | false | enter | Submit type |
customStyle | CSSStyleDeclaration | false | {} | Custom input style |
loading | boolean | false | false | Loading state |
disabled | boolean | false | false | Disabled state |
clearable | boolean | false | false | Show clear button |
headerAnimationTimer | number | false | 300 | Header animation duration |
mentionConfig | MentionConfig | false | null | User mention config |
triggerConfig | TriggerConfig[] | false | null | Command popup config |
selectConfig | SelectConfig[] | false | null | Tag selection config |
tipConfig | TipConfig | boolean | false | true | Prefix tip config (true enables defaults, false disables, object enables with custom options) |
getPlugin | () => typeof XSender | false | null | Custom underlying plugin version |
tipConfig is passed through to the underlying x-sender plugin as-is. This component does not merge defaults on its own: booleans act as an on/off switch, and an object provides custom options.
MentionConfig
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
dialogTitle | string | true | '' | Mention popup title |
options | <{ id: string, name: string, avatar?: string }>[] | true | [] | Data options |
callEvery | boolean | false | false | Enable "mention all" option |
everyText | string | false | 所有人 | "Mention all" option text |
asyncMatch | (matchStr: string) => Promise<MentionItem[]> | false | null | Enable async matching mode |
emptyText | string | false | 暂无数据 | Empty result text |
TriggerConfig
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
dialogTitle | string | true | '' | Command popup title |
key | string | true | null | Trigger key for command selection |
options | <{ id: string, name: string }>[] | true | [] | Data options |
SelectConfig
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
dialogTitle | string | true | '' | Tag selection popup title |
key | string | true | null | Tag selection identifier |
options | <{ id: string, name: string, preview?: string }>[] | true | [] | Data options |
multiple | boolean | false | false | Enable multiple selection |
emptyText | string | false | 暂无数据 | Empty result text |
showSearch | boolean | false | false | Enable search function |
placeholder | string | false | 输入关键字查询 | Search placeholder |
searchEmptyText | string | false | 暂无数据 | Empty search result text |
TipConfig
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
tipTemplate | string | false | '' | Prefix tip template |
dialogTemplate | string | false | '' | Command popup template |
closeNames | string[] | false | [] | Key list to close popup |
offsetTop | number | false | 0 | Popup top offset |
