vue-at
vue-at copied to clipboard
how to get selected members?
Need to get selected members on array
See discussion we had before.. https://github.com/fritx/vue-at/issues/8#issuecomment-304666006
What api do you prefer, or any suggestions?
@abzalzhumabaev you want the list of all the @xx
patterns in the content or the only ones selected from at-panel, or both of them?
- [ ] .getAtList()
- [ ] .getSelectedList()
@fritx Both of them I think : get all the referenced members (it does not matter if they are referenced via one way or another)
Any update on this?
Not yet supported, it would base on a regex match though.
For now you could probably use your own to match all the @
d members.
textarea中我也需要获取选中的成员,但现在我测试在@change
的getlist
或getSelectedList
都是没有用的,最终我如果想知道选中的人只能通过正则吗?这样很不友好,望能添加此功能,并且希望能加上一个类似At.js
的功能,能动态获得用户,因为在一般场景下,当用户超过一定数量,数据显示将变得很难处理,希望能得到这个功能,谢谢
$('#inputor').atwho({ at: "@", callbacks: { matcher: function(flag, subtext) { var match, matched, regexp; regexp = new XRegExp('(\\s+|^)' + flag + '(\\p{L}+)$', 'gi'); match = regexp.exec(subtext); // ... get matched result return matched; } //, ... others callbacks } });
@SamHz 好的,但其实这个从content中匹配@了那些人,也可以理解为是一个多处都会公用到的逻辑,不算在这个库的范畴(比如后台也会用到)。
所以可以考虑一下自己实现,(我们这边的产品就是这样,另外自己匹配出来)。
这段逻辑库如果能包办也不错,如果不包办,走文档中能体现确实也很必要。
动态获取展示,可以参考一下这个做法 https://github.com/fritx/vue-at/issues/16#issuecomment-332897002 ,但不确定能否暂时解决你的问题
Hi there, is this feature supported yet? Thanks.
可以在插入内容的时候处理已选的人员id,在方法insertItem中处理 if ( mentionUserIds && JSON.stringify(mentionUserIds).indexOf(curItem.id) == -1 ) { mentionUserIds.push(curItem.id); } 然后通过this.$refs.mentionUserIds获取到,中间有一些陈述省去了,主要就是在插入名字的时候处理被选的人员列表
I am using <at-ta/>
with textarea and in my case I can't get getAtList();
<at-ta
:hoverSelect="true"
:members="members"
v-model="usersMentioned"
name-key="name"
@at="handleAt"
@insert="handleInsert"
@change="handleAtChange"
ref="atTa"
:avoidEmail="false"
>
<template slot="item" slot-scope="s">
<span v-text="s.item.name"></span>
</template>
<el-input
type="textarea"
placeholder="Add to Conversation"
v-model="replyData.message"
></el-input>
</at-ta>
handleAtChange(data) {
this.usersMentioned = data;
},
reply(){
console.log(this.$refs.atTa.getAtList);// The method does not exist
}