-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp/pkp-lib#10624 Move autosuggest functions from api to component
- Loading branch information
1 parent
edf49a6
commit a49eace
Showing
3 changed files
with
34 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,3 @@ | ||
import {ref, inject} from 'vue'; | ||
|
||
export function useAutosuggest() { | ||
const allowCustom = inject('allowCustom', false); | ||
const localInputValue = ref(''); | ||
const isFocused = ref(false); | ||
|
||
function handleChange(event, emit) { | ||
localInputValue.value = event.target.value.trim(); | ||
emit('update:inputValue', localInputValue.value); | ||
} | ||
|
||
function handleFocus(emit) { | ||
isFocused.value = true; | ||
emit('update:isFocused', isFocused.value); | ||
} | ||
|
||
function handleBlur(emit) { | ||
isFocused.value = false; | ||
emit('update:isFocused', isFocused.value); | ||
} | ||
|
||
return { | ||
allowCustom, | ||
localInputValue, | ||
isFocused, | ||
handleChange, | ||
handleFocus, | ||
handleBlur, | ||
}; | ||
return {}; | ||
} |