TerryZ / v-suggest

A Vue2 plugin for input content suggestions, support using keyboard to navigate and quick pick, it make use experience like search engine input element
https://terryz.github.io/vue/#/suggest
MIT License
76 stars 16 forks source link

Uncaught TypeError: Cannot read property 'toLowerCase' of undefined #8

Closed cpfarher closed 5 years ago

cpfarher commented 5 years ago

There is a bug on line https://github.com/TerryZ/v-suggest/blob/master/src/Suggest.vue#L168, I think you must check for undefined values...

cpfarher commented 5 years ago

@TerryZ my error! I realized that the problem is when you pass a show-field that doesn't exist on the data list... I pass descripcion instead of description.... Anyway, maybe you need to keep present this type of errors and alert with a warning? and catch the exception?

TerryZ commented 5 years ago
  1. When null, undefined or some abnormal situation else in data field, it will parse to '' (empty string).
  2. When you pass wrong field name, i think throw that error in console will be better