Open boi1 opened 5 years ago
@boi1 hi there is a related issue before but in Chinese https://github.com/fritx/vue-at/issues/26#issuecomment-331862114
<button @click="insertAt">@</button>
<at :at="at" :members="members">
<textarea ref="ed"></textarea>
</at>
insertAt () {
let { ed } = this.$refs
ed.focus() // 如果之前没有焦点,则会定位到文本最前而不是最后,可能可以改进
document.execCommand('insertText', 0, ' ' + this.at) // 一般应该要加空格
let e = document.createEvent('HTMLEvents')
e.initEvent('input', true, true)
ed.dispatchEvent(e)
}
Thank you for the fast answer, this works also with contenteditable tested with 2.5.0-beta
Hi, i'm trying to find a way to also trigger vue-at to show a member selection on button click. For example while writing this issue on github, they offer also the function to trigger the mention functionality by button click.![2019-04-03 15_10_35-New Issue · fritx_vue-at](https://user-images.githubusercontent.com/36037583/55481466-c249bd00-5622-11e9-8c8f-74b6c7433023.png)