https://github.com/byteboomers/vue-autofocus-directive
Vue autofocus directive
https://github.com/byteboomers/vue-autofocus-directive
autofocus vue vue-autofocus-directive vuejs
Last synced: about 2 months ago
JSON representation
Vue autofocus directive
- Host: GitHub
- URL: https://github.com/byteboomers/vue-autofocus-directive
- Owner: byteboomers
- License: mit
- Created: 2018-03-03T21:54:58.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-30T11:52:47.000Z (8 months ago)
- Last Synced: 2024-09-30T09:03:23.360Z (7 months ago)
- Topics: autofocus, vue, vue-autofocus-directive, vuejs
- Language: JavaScript
- Size: 516 KB
- Stars: 34
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-autofocus-directive
Autofocus directive for Vue
## About
Lifted from the official Vue tutorial: https://vuejs.org/v2/guide/custom-directive.html
When the page loads, the element with the directive gains focus (note: autofocus doesn’t work on mobile Safari).
## Installation
```bash
npm install --save vue-autofocus-directive
```[npm package link](https://www.npmjs.com/package/vue-autofocus-directive)
## Usage
```javascript
import Vue from "vue";
import autofocus from "vue-autofocus-directive";
Vue.directive("autofocus", autofocus);
``````html
```
## Options
### `binding`
- Type: `value`
- Default: `undefined`
- Description: _Required when using dynamic value_## Example
```vue
```
or
```vue
export default {
data() {
return {
dynamicValue: false
};
}
};```