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

How set Value on page load #65

Open
salvatorelapi opened this issue Feb 10, 2018 · 4 comments
Open

How set Value on page load #65

salvatorelapi opened this issue Feb 10, 2018 · 4 comments

Comments

@salvatorelapi
Copy link

initValue work if value is static

data(){
return {
locality_name: 'aas'
}
}

when locality_name is changed by other function value is alwais "aas".

In documentation we have this.$refs.autocomplete.setValue(string) but not work. How can fix ?

@constantm
Copy link

@salvatorelapi you need to specify autocomplete as the ref for the child component, after which this.$refs.autocomplete.setValue(string) will work:

<autocomplete
      ref="autocomplete"
      :url="userSearchUrl"
      anchor="email"
      label="first_name"
      :on-select="addUser">
</autocomplete>

You can then set the value through:

export default {
  props: ['userSearchUrl'],
  components: {
    autocomplete: Vue2Autocomplete
  },
  created: function() {
    this.$refs.autocomplete.setValue('new value')
  }
}

@NguyenTheSon
Copy link

initValue not working import file data update autocomplete first item ?.
image
view
image

@teddy-dubal
Copy link

@NguyenTheSon i've got the same issue

@NguyenTheSon
Copy link

@teddy-dubal you can use this.$refs.autocomplete.setValue solve the problem

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

4 participants