Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@at does not return all of the entered text #124

Open
meatfound opened this issue Aug 7, 2020 · 2 comments
Open

@at does not return all of the entered text #124

meatfound opened this issue Aug 7, 2020 · 2 comments
Assignees

Comments

@meatfound
Copy link

meatfound commented Aug 7, 2020

  • vue 2.6.11

  • vue-at 2.5.0-beta.2

I'm trying to search member dynamically,
but I can't getting a full text that I was inputted. (lost last word..)

here is my code,

       <at
          :members="userInformations.results"
          name-key="name"
          @at="handleAt"
          v-model="newComment"
          class="at-ta"
         >
          <template v-slot:item="s">
            <!-- blah blah -->
          </template>
          <template v-slot:embeddedItem="s">
            <!-- blah blah -->
          </template>
          <div contenteditable class="comment-edit"></div>
        </at>

and my script code,

handleAt(chunk) {
   console.log("handleAt", chunk);
   if (chunk) {
      if (chunk.length > 0) {
        this.queryUserInformations([chunk]);
       }
    }
 }

I was entered text '테스트' , but @at returned '테스'.

is it related an IME ? (https://vuejs.org/v2/guide/forms.html#vmodel-ime-tip)
is it Ok with use 中文 or japanese?
谢谢.

@fritx fritx self-assigned this Aug 7, 2020
@fistSea
Copy link

fistSea commented Sep 16, 2020

I also encountered this problem, but after the at name, add a space to get the integrity.

@fritx
Copy link
Owner

fritx commented Oct 16, 2020

hi @fistSea @meatfound , is this live demo working for both of you?
https://coldemo.js.org/#/playground/vue-at.js

try to add handleAt like

let App = {
  components: { At: VueAt },
  template: `
    <div class="container">
      <h1>Vue At</h1>
      <a target="_blank" href="https://github.com/fritx/vue-at">
        https://github.com/fritx/vue-at
      </a>
      <at :members="members" v-model="input" @at="handleAt">
        <div class="editor" contenteditable></div>
      </at>
    </div>
  `,
  data() {
    return {
      members: [
        'fritx', 'linguokang', 'huangruichang'
      ],
      input: '@fritx @huangruichang '
    }
  },
  methods: {
    handleAt(chunk) { console.log([chunk]) }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants