koel/resources/assets/js/directives/focus.js
2016-06-26 00:05:24 +08:00

14 lines
245 B
JavaScript

import Vue from 'vue';
/**
* A simple directive to set focus into an input field when it's shown.
*/
export const focusDirective = {
update(el, { value }) {
if (!value) {
return;
}
Vue.nextTick(() => el.focus());
},
};