fritx / vue-at

At.js for Vue.
https://fritx.github.io/vue-at/
MIT License
529 stars 114 forks source link

is it possible to get members list from remote request ? #16

Open zhang-xiao opened 7 years ago

zhang-xiao commented 7 years ago

like giving suggestion items from server side when input @suggestion

fritx commented 6 years ago

@zhang-xiao @4ver what kind of api do you like?

like passing a prop fetch? http://element.eleme.io/#/en-US/component/input#autocomplete

<el-autocomplete
  class="inline-input"
  v-model="state2"
  :fetch-suggestions="querySearch"
  placeholder="Please Input"
  :trigger-on-focus="false"
  @select="handleSelect"
></el-autocomplete>
Minasokoni commented 6 years ago

+1 on this. Couldn't you just get away with throwing an $emit on the open trigger and then we can create a method to get and populate members

fritx commented 6 years ago

@Minasokoni nice idea! Didn't see such a way in other framworks like Element-UI. Did you see this feature in other places?

fritx commented 6 years ago

@Minasokoni added $emit('at'), but not published yet, try

npm i -S "git+https://github.com/fritx/vue-at.git#feat/emit-at-build"
<at :members="members" @at="handleAt"></at>

<script>
// ...
async handleAt (chunk) {
  this.members = await fetchFromRemote(chunk)
}
</script>
fritx commented 6 years ago

The branch is buggy now, need more time to fix. @Minasokoni

Minasokoni commented 6 years ago

@fritx no rush 👍 Thanks for the quick responses though

fritx commented 6 years ago

@Minasokoni you can try the branch now xD, just pushed.

fritx commented 6 years ago

Hey guys, 2.3.0 is out including this feature: emitting at event. for usage demo see above: https://github.com/fritx/vue-at/issues/16#issuecomment-332897002

However, it is not documented yet, and it is quite experimental for now, needs more test and fix.

docs: https://fritx.github.io/vue-at/#/en/faq

johnenrick commented 5 years ago

The @at event doesnt work. I was able to change the :member but when I hit enter, the name dont appear on the text field.

fritx commented 5 years ago

What about your code? Did you bind v-model? @johnenrick