koel/resources/assets/js/directives/focus.js

13 lines
224 B
JavaScript
Raw Normal View History

2015-12-13 04:42:28 +00:00
/**
* A simple directive to set focus into an input field when it's shown.
*/
export default function (value) {
if (!value) {
return;
}
var el = this.el;
2015-12-14 13:13:12 +00:00
Vue.nextTick(() => el.focus());
2015-12-13 04:42:28 +00:00
}