今天遇到个问题,我在手机做一个选择生日的功能,但是当我点击input框时,事件选择插件和输入法都弹出来了,很丑,然后就想阻止输入法弹出来,

网上一个方法是:在input框的获取焦点事件里,主动触发失去焦点事件,这样就阻止输入法的弹出了,很好,上个代码:

<input type="text" class="nameInput birthDayInput" placeholder="点击选择生日日期" @focus="openPicker()" v-model="comInfo.birthday">
openPicker() {
            document.activeElement.blur();//主动触发onblur事件,是原生的js哟
            this.$refs.picker.open();//这个方法不要管,是其它代码
        },

 

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2021-11-03
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案