mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
feat(components): [mention] add whole-remove event (#21050)
* feat(components): [mention] 添加mention-remove事件,当props.whole为真且移除提及项时触发 * feat(components): [mention] 添加whole-remove事件,当props.whole为真且移除提及项时触发 * feat(components): [mention]添加 whole-remove事件,并更新了文档说明 * feat(components): [mention]添加 whole-remove事件,并更新了文档说明 * feat(components): [mention]添加 whole-remove事件,并更新了文档说明 * feat(components): [mention]添加 whole-remove事件,并更新了文档说明 * Update docs/en-US/component/mention.md --------- Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
@@ -105,11 +105,12 @@ and please go to the original component to view the documentation.
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Description | Type |
|
||||
| --------------------------------- | ----------------------------------- | ------------------------------------------------------------ |
|
||||
| search | trigger when prefix hit | ^[Function]`(pattern: string, prefix: string) => void` |
|
||||
| select | trigger when user select the option | ^[Function]`(option: MentionOption, prefix: string) => void` |
|
||||
| [input events](./input.md#events) | — | — |
|
||||
| Name | Description | Type |
|
||||
| --------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
||||
| search | trigger when prefix hit | ^[Function]`(pattern: string, prefix: string) => void` |
|
||||
| select | trigger when user select the option | ^[Function]`(option: MentionOption, prefix: string) => void` |
|
||||
| whole-remove ^(2.10.4) | trigger when a whole mention is removed and `whole` is `true` or `check-is-whole` is `true` | ^[Function]`(pattern: string, prefix: string) => void` |
|
||||
| [input events](./input.md#events) | — | — |
|
||||
|
||||
### Slots
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ export const mentionProps = buildProps({
|
||||
|
||||
export const mentionEmits = {
|
||||
[UPDATE_MODEL_EVENT]: (value: string) => isString(value),
|
||||
'whole-remove': (pattern: string, prefix: string) =>
|
||||
isString(pattern) && isString(prefix),
|
||||
input: (value: string) => isString(value),
|
||||
search: (pattern: string, prefix: string) =>
|
||||
isString(pattern) && isString(prefix),
|
||||
|
||||
@@ -178,6 +178,7 @@ const handleInputKeyDown = (event: KeyboardEvent | Event) => {
|
||||
inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1)
|
||||
emit(UPDATE_MODEL_EVENT, newValue)
|
||||
emit(INPUT_EVENT, newValue)
|
||||
emit('whole-remove', pattern, prefix)
|
||||
|
||||
const newSelectionEnd = prefixIndex
|
||||
nextTick(() => {
|
||||
|
||||
Reference in New Issue
Block a user