Skip to content

Instantly share code, notes, and snippets.

@tohagan
Last active March 18, 2021 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tohagan/5bff56b9e2a39747036859696435ef10 to your computer and use it in GitHub Desktop.
Save tohagan/5bff56b9e2a39747036859696435ef10 to your computer and use it in GitHub Desktop.
Select search box using key stroke
```js
<!-- watch for ctrl-/ - Vue2 only. -->
<div @keyup.ctrl.191="$root.$emit('onSearchFocus')" />
...
<v-text-field ref="search" ... >
...
</v-text-field>
created() {
this.$root.$on("onSearchFocus", () => {
debugger;
const search: any = this.$refs.search;
search.$refs.input.focus();
});
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment