UNPKG

uview-plus

Version:

零云®uview-plus已兼容vue3支持多语言,120+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名、Markdown等。

30 lines (26 loc) 767 B
/** * uni API shims * * 部分小程序平台(如支付宝)不支持某些 uni API,直接调用会抛出 TypeError。 * 本模块在库初始化时检测缺失的 API 并自动补齐空实现,防止运行时报错。 * * 扩展方式:在 needShims 数组中追加 { name, fallback } 即可。 */ const needShims = [ { name: 'onWindowResize', fallback: function (_callback) { /* no-op */ } }, { name: 'offWindowResize', fallback: function (_callback) { /* no-op */ } } ] export function applyUniApiShims() { if (typeof uni === 'undefined') return for (const { name, fallback } of needShims) { if (typeof uni[name] !== 'function') { uni[name] = fallback } } }