FastClick(解决ios中click的延迟300s问题)

解决了input中的清空按钮失效(由于键盘弹起导致的按钮失效)
1.npm install fastclick
2. import FastClick from ‘fastclick’
3. 在页面中引用
1用在body上:
FastClick.attach(document.body)
2.用在某个元素上 FastClick.attach(document.getElementById(“appointment”));//取消苹果手机延迟click事件
fastClick会导致隐藏的input的点击事件失效。
故input不隐藏,给个css:
position: absolute;
top: 0;
width: 56px;//代替input框显示的那个button的宽度
opacity: 0;
列如:添加附件

<div class="pb-10 relative">
                  <span class="text-active" @click="addEnclosure(item,index)">添加附件</span>
                  <input type="file" :id="`files-${index}`" :ref="`files-${index}`" multiple
                         @change="handleFilesUpload(item,index)" class="add-enclosure-input-class"
                         :accept="acceptList.join(',')"/>
                </div>
addEnclosure(item, index) {//添加附件
                this.$nextTick(()=>{
                        document.getElementById(`files-${index}`).click();//模拟点击input
                })

            },
 .add-enclosure-input-class{
      position: absolute;
      top: 0;
      width: 56px;
      opacity: 0;
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值