ElementUI的Select组件在IOS唤不起软键盘

与网上所有描述的一样,这是一个readonly属性导致的问题。但网上的博客里的解决方式都不符合我的预期,在通过多种方式搜索后,终于看到issue一个完美地解决方案。

hypeJunction: I initially had a new component that extended element’s select. That quickly became unmanageable. What I realised though is that you can stub elementui and then import the stubbed instance:

import ElementUi from 'element-ui';

// Fixes an issue with filters not working on mobile
ElementUi.Select.computed.readonly = function () {
    // trade-off for IE input readonly problem: https://github.com/ElemeFE/element/issues/10403
    const isIE = !this.$isServer && !Number.isNaN(Number(document.documentMode));

    return !(this.filterable || this.multiple || !isIE) && !this.visible;
};

export default ElementUi;

这位作者的这种方式实在太棒了,ElementUI没有修复的BUG就我们自己修复。

关于怎么使用:可以编写成一个单独的js文件,然后在根目录下index.js文件中引入。这样根目录下index.js会运行这段代码,之后按原来使用该组件的方式使用就行。

  • 11
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值