| | |
| | | import type { App } from 'vue'; |
| | | import { nextTick, type App } from 'vue'; |
| | | const map = new WeakMap(); |
| | | const ob = new ResizeObserver((entries) => { |
| | | for (const entry of entries) { |
| | |
| | | }); |
| | | }; |
| | | |
| | | |
| | | |
| | | export const eleFocusDirective = (app: App) => { |
| | | app.directive('elInputFocus', { |
| | | mounted: (el) => { |
| | | el.querySelector('input.el-input__inner')?.focus(); |
| | | mounted: (el, binding: any) => { |
| | | const inputInner = el.querySelector('input.el-input__inner'); |
| | | inputInner?.focus(); |
| | | // 选中 input 中的所有内容 |
| | | // 判断是否绑定值有要选中 |
| | | if (binding.value) { |
| | | nextTick(() => { |
| | | inputInner?.select(); |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | }); |
| | | }; |
| | | }; |