UNPKG

press-ui

Version:

简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目

24 lines (19 loc) 450 B
import { isNotInUni } from '../utils/utils'; function innerHideKeyboard() { const { activeElement } = document; if (activeElement && (activeElement.tagName === 'TEXTAREA' || activeElement.tagName === 'INPUT')) { activeElement.blur(); } } export function hideKeyboard() { // #ifdef H5 if (isNotInUni()) { innerHideKeyboard(); } else { uni.hideKeyboard(); } // #endif // #ifndef H5 uni.hideKeyboard(); // #endif }