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

14 lines
252 B
JavaScript

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