darrenjennings / vue-autosuggest

🔍 Vue autosuggest component.
https://darrenjennings.github.io/vue-autosuggest
MIT License
621 stars 91 forks source link

Expand renderSuggestion documentation #49

Closed ronaldborman closed 6 years ago

ronaldborman commented 6 years ago

I'm porting a react-autosuggest based component to Vue and this project (as it lists react-autosuggest as an inspiration) seems to fit the bill nicely.

As I'm prototyping, I didn't want to use a build step but instead only use ES5. The renderSuggestion function documentation was a bit of a disappointment because it stated: "If you're not using babel-plugin-transform-vue-jsx then this method won't be too beneficial". Because I needed to render a multi-div suggestion, it looked like a showstopper.

However, you can use ES5 and $createElement to create the exact same output. Certainly not recommended for larger chunks of markup, but appropriate for this use case imho.

I think it would be benifical if the documentation was expanded/changed with something like: "but if you don't use babel or the JSX transform, you still can build the JSX structure yourself, e.g. renderSuggestion(suggestion) { return this.$createElement('div', { 'style': { color: 'red'} }, suggestion.name) }"

If preferred, I could submit a PR.

darrenjennings commented 6 years ago

Ronald, yes I had meant to add another example without the JSX transform, but a comment that you are suggesting would be perfect! My wife had a baby this week so might not get to it if you could submit a PR, would be much appreciated.

ronaldborman commented 6 years ago

First of all, congrats!

I just submitted PR #50. Feel free to make any changes.

darrenjennings commented 6 years ago

thanks @ronaldborman !