4 * Toggles the adding of a 'loading' class to the main
5 * .v-select wrapper. Useful to control UI state when
6 * results are being processed through AJAX.
14 * Accept a callback function that will be
15 * run when the search text changes.
17 * loading() accepts a boolean value, and can
18 * be used to toggle a loading class from
19 * the onSearch callback.
21 * @param {search} String Current search text
22 * @param {loading} Function(bool) Toggle loading class
26 default: function(search, loading){}
38 * If a callback & search text has been provided,
39 * invoke the onSearch callback.
42 if (this.search.length > 0) {
43 this.onSearch(this.search, this.toggleLoading)
44 this.$emit('search', this.search, this.toggleLoading)
48 * Sync the loading prop with the internal
49 * mutable loading value.
53 this.mutableLoading = val
59 * Toggle this.loading. Optionally pass a boolean
60 * value. If no value is provided, this.loading
61 * will be set to the opposite of it's current value.
62 * @param toggle Boolean
65 toggleLoading(toggle = null) {
67 return this.mutableLoading = !this.mutableLoading
69 return this.mutableLoading = toggle