Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
vue-focus
Advanced tools
Changelog
[2.0.0-rc2] - 2016-09-28
Readme
A reusable focus directive for reusable Vue.js components
It can be tricky to manage input focus. You always have to fall back to accessing DOM elements and calling .focus
or .blur
on them.
Well not anymore. vue-focus
lets you manage focus from the safety of your view model.
Check out the examples, read the docs or file an issue.
From npm:
$ npm install vue-focus --save
From CDN:
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.0.0-rc2/vue-focus.js"></script>
<!-- OR -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.0.0-rc2/vue-focus.min.js"></script>
focus
A directive that binds focus to the expression in a one-way manner, so that the element recieves focus when the expression becomes truthy
and loses focus when the expression becomes falsy
.
import { focus } from 'vue-focus';
export default {
directives: { focus: focus },
template: '<input type="text" v-focus="focused" @focus="focused = true" @blur="focused = false">',
data: function() {
return {
focused: false,
};
},
};
mixin
A mixin that makes the v-focus
directive available to the component under the default name.
import { mixin as focusMixin } from 'vue-focus';
export default {
mixins: [ focusMixin ],
template: '<input type="text" v-focus="focused" @focus="focused = true" @blur="focused = false">',
data: function() {
return {
focused: false,
};
},
};
Form elements are not the only elements that are able to receive focus. The list also includes links, element with tabindex
attribute set and elements with contentEditable
set to true
.
FAQs
A set of reusable focus directives for reusable Vue.js components
The npm package vue-focus receives a total of 5,538 weekly downloads. As such, vue-focus popularity was classified as popular.
We found that vue-focus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.