koel/resources/assets/js/directives/focus.js
2016-02-09 11:57:08 +07:00

14 lines
240 B
JavaScript

import Vue from 'vue';
/**
* 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;
Vue.nextTick(() => el.focus());
}