Buefy: "methods" option in the API

Created on 14 Oct 2017  路  1Comment  路  Source: buefy/buefy

Hello, I have seen that some components have the "methods" option in the API, but it is not clear what that would be and how to use it. I tried to find some examples but to no avail. What's different about it with "events" and an example of usage.

Most helpful comment

@mikejavier When you use a component the best practice is to use only props and events but sometimes you could need to force a behaviour of a component calling its method.
For example:

<b-autocomplete ...
       ref="autocomplete">
</b-autocomplete>

export default {
        ...
        mounted() {
             this.$refs.autocomplete.setSelected(...)
        }
}

>All comments

@mikejavier When you use a component the best practice is to use only props and events but sometimes you could need to force a behaviour of a component calling its method.
For example:

<b-autocomplete ...
       ref="autocomplete">
</b-autocomplete>

export default {
        ...
        mounted() {
             this.$refs.autocomplete.setSelected(...)
        }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Trevald picture Trevald  路  3Comments

BenjaminVockenberg picture BenjaminVockenberg  路  3Comments

evandroabukamel picture evandroabukamel  路  3Comments

daltonrooney picture daltonrooney  路  3Comments

diego-lipinski-de-castro picture diego-lipinski-de-castro  路  3Comments