Skip to content

Commit

Permalink
fix(mention): 修复Mention 组件的联想文字选中后应替换触发输入的联想文本,而非追加 #1303
Browse files Browse the repository at this point in the history
  • Loading branch information
handsomezyw authored and kagol committed Sep 5, 2022
1 parent c25fb4a commit 7c3bafe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/devui-vue/devui/mention/src/mention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default defineComponent({
e.stopPropagation();
e.preventDefault();
showSuggestions.value = false;
textContext.value += item[props.dmValueParse.value as keyof IMentionSuggestionItem];
textContext.value = textContext.value.substring(0, 1) + item[props.dmValueParse.value as keyof IMentionSuggestionItem];
};

const arrowKeyDown = (e: KeyboardEvent) => {
Expand Down Expand Up @@ -102,7 +102,9 @@ export default defineComponent({
e.stopPropagation();
e.preventDefault();
showSuggestions.value = false;
textContext.value += filteredSuggestions.value[currentIndex.value][props.dmValueParse.value as keyof IMentionSuggestionItem];
textContext.value =
textContext.value.substring(0, 1) +
filteredSuggestions.value[currentIndex.value][props.dmValueParse.value as keyof IMentionSuggestionItem];
emit('select', filteredSuggestions.value[currentIndex.value]);
}
}
Expand Down

0 comments on commit 7c3bafe

Please sign in to comment.