Skip to content

Instantly share code, notes, and snippets.

@benvp
Created July 17, 2020 13:25
Show Gist options
  • Save benvp/5e425592347beb95e458c6f4517496c8 to your computer and use it in GitHub Desktop.
Save benvp/5e425592347beb95e458c6f4517496c8 to your computer and use it in GitHub Desktop.
<script>
function autocomplete() {
return {
// ...
focus: 0,
setFocus(f) {
this.focus = f;
},
// ...
}
}
</script>
<!--
Add the following two attributes to the <li> suggestion item
-->
<li
@mouseenter="setFocus(<%= index %>)"
:class="{ 'focus': focus === <%= index %> }"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment