移动端禁止长按事件触发的复制粘贴

﹥>﹥吖頭↗ 提交于 2019-11-26 02:24:10

移动端禁止长按事件触发的复制粘贴

页面中全部文字内容禁止长按复制的方法 CSS 写法

*{
-webkit-touch-callout:none; /系统默认菜单被禁用/
-webkit-user-select:none; /webkit浏览器/
-khtml-user-select:none; /早期浏览器/
-moz-user-select:none; /火狐/
-ms-user-select:none; /IE10/
user-select:none;
}

缺点:会导致input框不能用
解决方法:
input{
-webkit-user-select: auto;
}

**

移动端禁止手机键盘弹出的方法

**

1.readonly
给input标签设置 readonly 属性
缺点:在iOS的Safari中无效
2.blur()方法
document.activeElement.blur()
当你的input获取焦点时 onfocus监听获取焦点事件时 调用document.activeElement.blur()方法

html :
<input   type="text"   @focus="Focus" />
js:
methods:{
	Focus(){
			document.activeElement.blur() 
      		}
}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!