diff --git a/src/App.vue b/src/App.vue
index f318d5c..3a5bd0a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,12 +2,12 @@
-
-
+
@@ -18,7 +18,7 @@
-
+
diff --git a/src/At.vue b/src/At.vue
index 0728050..d8c0fc7 100644
--- a/src/At.vue
+++ b/src/At.vue
@@ -67,7 +67,12 @@ export default {
scrollRef: {
type: String,
default: ''
- }
+ },
+ processItem: {
+ type: Function,
+ default: (list, cur, suffix) => {
+ return itemName(list[cur]) + suffix
+ }
},
data () {
@@ -352,7 +357,7 @@ export default {
// hack: 连续两次 可以确保click后 focus回来 range真正生效
applyRange(r)
applyRange(r)
- const t = itemName(list[cur]) + suffix
+ const t = processItem(list, cur, suffix)
this.insertText(t, r)
this.handleInput()
}
diff --git a/src/AtTemplate.vue b/src/AtTemplate.vue
index 27fb687..d525443 100644
--- a/src/AtTemplate.vue
+++ b/src/AtTemplate.vue
@@ -20,6 +20,7 @@
:class="isCur(index) && 'atwho-cur'"
:ref="isCur(index) && 'cur'"
:data-index="index"
+ :key="index"
@mouseenter="handleItemHover"
@click="handleItemClick"
>
diff --git a/src/AtTextarea.vue b/src/AtTextarea.vue
index 7001e01..bbcf912 100644
--- a/src/AtTextarea.vue
+++ b/src/AtTextarea.vue
@@ -137,7 +137,7 @@ export default {
const start = index + at.length // 从@后第一位开始
el.selectionStart = start
el.focus() // textarea必须focus回来
- const t = itemName(list[cur]) + suffix
+ const t = processItem(list, cur, suffix)
this.insertText(t, el)
this.handleInput()
}