koel/resources/assets/js/directives/focus.js
2016-06-25 16:21:39 +08:00

14 lines
250 B
JavaScript

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