UNPKG

@komtek/el-grid

Version:

A Vue.js component which combines form, table, pagination components from Element UI.

24 lines (20 loc) 624 B
import Vue from 'vue'; import Inputmask from 'inputmask'; export default Vue.directive('mask', { bind(el, binding) { if (binding.value) { let options = binding.arg === 'datetime' ? { alias: 'datetime', inputFormat: binding.value, placeholder: binding.value } : binding.value; const selectorList = el.querySelectorAll('input'); selectorList.length ? Array.from(selectorList, inputNode => new Inputmask(options).mask(inputNode)) : new Inputmask(options).mask(el); } } });