/**
 * v-select指令
 * 选中输入框
 */
export default function select(el: HTMLElement) {
  if (el.tagName === 'INPUT') {
    el.addEventListener('focus', (ele) =>
      (ele.target as HTMLInputElement).select(),
    )
  } else {
    const dom = el.querySelector('input')
    dom &&
      dom.addEventListener('focus', (ele) =>
        (ele.target as HTMLInputElement).select(),
      )
  }
}
