ikloster03 / vue-dadata

Vue component for hinting addresses using dadata.ru
https://vue-dadata.ikloster.tech
MIT License
28 stars 31 forks source link

onChange problem #44

Closed SlivaNilow closed 4 years ago

SlivaNilow commented 4 years ago

hi, I'm using your solution in my project. Here's the code call

<vue-dadata token="my_api_key"
             placeholder="Work address"
              inputName="address"
             onChange="setAddress"
></vue-dadata>

in component methods block im write

setAddress: function(data) {
      console.log(data)
},

but in console im get error

app.js:40739 Uncaught (in promise) TypeError: this.onChange is not a function
    at a.selectSuggestion (app.js:40739)

what am I doing wrong? I didn't find any examples of using the method correctly

dbapril commented 4 years ago

Присоединяюсь, дайте какой-нибудь пример использования, полдня убил на этот метод и ноль результатов.

ikloster03 commented 4 years ago

Hello @gelid and @dbapril ! I've added the onChange example @gelid, for your code:

<vue-dadata 
   token="my_api_key"
   placeholder="Work address"
   inputName="address"
   :onChange="setAddress"
></vue-dadata>

You should use v-bind directive. And you can more read here.