ios 下 new Date('2020-03-11 00:00:00')
不生效,需要对日期进行 date.replace(/-/g, '/')
处理。
ios 下 beforeunload
事件废弃了,需要使用 pagehide
事件替代。
// vue
<input ref="input" v-model="form.name" placeholder="请输入您的名字" @input="inputVal" @focus="focus" />
// ...
focus () {
const u = navigator.userAgent;
const isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; // 判断机型,android终端
if (isAndroid) {
const that = this
const originalHeight = document.documentElement.clientHeight || document.body.clientHeight
window.onresize = function () {
const resizeHeight = document.documentElement.clientHeight || document.body.clientHeight
if (resizeHeight - 0 < originalHeight - 0) {
that.$refs.input.style.bottom = `-${
originalHeight - resizeHeight}px`
} else {
that.$refs.input.style.bottom = `0px`
}
}
}
},
因为是点击input后触发的问题,所以应该在input聚焦时处理,也就是放在focus事件中改变页面的top值。
下面是解决该问题的大概的模板:
// vue
<input ref="input" v-model="form.name" placeholder="请输入您的名字" @input="inputVal" @focus="focus" />
// ...
focus () {
const u = navigator.userAgent;
const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // 判断机型,ios终端
if (isiOS) {
document.body.addEventListener("focusin", () => {
// 软键盘弹出的事件处理
this.isShowFooterBar = false;
});
document.body.addEventListener("focusout", () => {
// 软键盘收起的事件处理
this.isShowFooterBar = true
});
}
}
【拓展】
ios:focusin
和 focusout
事件支持冒泡,分别对应 focus
和 blur
事件。
上面的方法中,之所以使用 focusin 和 focusout 的原因是:假设有多个输入框需要处理,这样就可以使用事件代理来处理多个输入框存在的情况了。
// vue
<input ref="input" v-model="form.name" placeholder="请输入您的名字" @input="inputVal" @blur.prevent="blur" />
// ...
blur () {
window.scrollTo(0, 0)
}
ios11之后,有些情况使用 input 事件 ios 自带的输入法,当选择拼音输入时会自动输入多个字符,这是因为有时 ios 对 input 事件不兼容导致的,使用 change 事件即可解决这个问题。
ios 收起输入法时会失去焦点,触发 change 事件,但是 Android 收起输入法时并不会失去焦点,所以可以通过判断 UA(navigator.userAgent) 的方式来针对不同系统使用不同的事件。
input:focus{
outline:none} // 去除外边框
input:{
-webkit-appearance: none;}
// android 中这样实现
input {
-webkit-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
}
// ios 中应当将上述样式中的属性 -webkit-user-select 的值由 none 改为 auto
input {
-webkit-user-select: auto;
}
input::-webkit-input-placeholder {
color: #bbb;
font-size: 0.3rem;
line-height: normal;
}
// 给你 input 去除 line-height 属性,然后添加下面的样式
input::-webkit-input-placeholder {
line-height: normal;
}
对于一般PC浏览器以及iOS设备的浏览器表现就是我们想要的居中效果,但是大部分 Android 设备的浏览器文字都会稍微向上偏离。
结合行高、对齐的关系 和 伪元素,可以给当前元素添加以下样式来尝试解决该问题:
&::before {
content: '';
display: inline-block;
vertical-align: middle;
width: 0;
height: 100%;
margin-top: 1px;
}
input, textarea {
border: 0;
-webkit-appearance: none;
}
img {
pointer-events: none; }
给其父元素添加 padding-top
,代替该元素的 margin-top
。
给该元素设置:
overflow-x: hidden;
给该元素设置:
position: fixed;
left: 0;
top: 0;
此方案亦可解决:H5 嵌入式开发时,让页面适配端上提供的组件。
iOS 底部有个小横条,如何保证内容不被横条遮挡呢?最好的办法就是用 CSS 来做下兼容。
第一步:需要在 index.html 文件中的 <mate> 标签中增设 viewport-fit
属性来改变网页在可视窗口的布局方式
viewport-fit 属性是 iOS11 新增的特性。苹果公司为了适配 iPhoneX 对现有 viewport meta 标签新增加的一个扩展,用于设置网页在可视窗口的布局方式。
viewport-fit 可设置三个值:
object-fit: contain;
)。object-fit: cover;
)。<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
第二步:在需要兼容的页面中用 env()
和 constant()
这两个 CSS 函数来设定安全区域以及边界的距离。
env() 和 constant() 是 iOS11 新增的两个 CSS 特性,用来设定安全区域以及边界的距离。
env() 和 constant() 可设置四个值:
.box {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 3.87rem;
padding-bottom: constant(safe-area-inset-bottom); /* 兼容 iOS<11.2 */
padding-bottom: env(safe-area-inset-bottom); /* 兼容 iOS>=11.2 */
}
【注意】constant 和 env 的先后顺序不能换。
【参考文献】网页适配 iPhoneX,就是这么简单
这是我遇到的一个问题,当时去掉 font-family
就好了。
因为,iOS 自带的回弹特效不会触发 scroll 事件,也就导致 scrollTop 的值为 undefined。需要做一个兼容:默认是 0 就好了——let scrollTop = e.target.scrollTop || 0
。
<meta name="format-detection" content="telephone=no">
<meta http-equiv="x-rim-auto-match" content="none">
文章浏览阅读4.2k次,点赞8次,收藏15次。CMC曲线(累计匹配曲线)CMC曲线在人脸识别,行人重识别等领域使用的非常多,但却很少有文章去详细的介绍CMC曲线,这是我在researchgate网页上某个博主主页上找到的关于CMC曲线的介绍,个人觉得通过例子讲解的形式来介绍CMC使得更加通俗易懂,让人一看就明白。以下是原文:I think that understanding a CMC curve is much easierb..._cmc曲线
文章浏览阅读1.3k次,点赞42次,收藏41次。CompletableFuture的异步执行通过ForkJoinPool实现,ForkJoinPool在于可以充分利用多核CPU的优势,把一个任务拆分成多个小任务,把多个小任务放到多个CPU上并行执行,当多个小任务执行完毕后,再将其执行结果合并起来。
文章浏览阅读958次。objShell.SendKeys “{F5}” ’ 模拟鼠标中键点击。WScript.Sleep(300000) ’ 延时5分钟。_windows防锁屏bat脚本
文章浏览阅读2.3k次。CentOS快速安装配置NVIDIA Container Toolkit_nvidia container toolkit
文章浏览阅读3.9k次。03-16 15:39:03.082 16179-16179/tech.androidstudio.handlerdemotimer E/global: Deprecated Thread methods are not supported.03-16 15:39:03.082 16179-16179/tech.androidstudio.handlerdemotimer E/global: _timethread().stop();报错
文章浏览阅读2.3k次。/*** 汉字转Unicode编码* @param string $str 原始汉字的字符串* @param string $encoding 原始汉字的编码* @param boot $ishex 是否为十六进制表示(支持十六进制和十进制)* @param string $prefix 编码后的前缀* @param string $postfix 编码后的后缀*/function unicode..._%e5
文章浏览阅读6.3k次。严重: 在路径为/book的上下文中,Servlet[jsp]的Servlet.service()引发了具有根本原因的异常java.lang.ClassNotFoundException:这种报错,除了其他人的:还有一种可能:名字不一样,哪怕是空格哪怕是一个空格!..._严重: 在路径为/bookmanage的上下文中,servlet[jsp]的servlet.service()引发了具
文章浏览阅读6.2k次。frida-ios-dump源码地址:GitHub - AloneMonkey/frida-ios-dump: pull decrypted ipa from jailbreak devicefrida-ios-dump是基于frida开发的一键砸壳工具,需要配置frida环境手机配置1)越狱状态2)安装openssh3)安装fridaMac配置1)安装frida,命令行:sudo pip install frida-tools (没有安装pip的话需要先安装pip)_ios砸壳需要 闪退怎么砸
文章浏览阅读2.6k次,点赞3次,收藏2次。1.制作系统应用程序。 ios的程序分为mobile和root权限模式,我们一般用xcode开发的app取得的是mobile权限,但是ios越狱后安装的app如:Cydia、91助手、PP助手等均为系统级应用程序。系统级app的好处是:用不无法手动删除、取得完全的root权限、可设置开机启动项等等功能。通过xcode打包的ipa是无法安装成为系统app的,所以我们需要另外一种打包方式:_depends libundirect.depends firmware
文章浏览阅读254次,点赞5次,收藏2次。继承1. 继承的基本概念1.1 继承的定义1.2 继承基类成员访问方式的变化2. 基类和派生类对象赋值转换3. 继承中的作用域1. 继承的基本概念继承是面向对象程序设计使代码复用的最重要的手段,允许在保持原有类特性的基础上进行扩展,增加功能,产生新的类,称为派生类/子类。继承是类设计层次的复用。1.1 继承的定义派生类 : 继承方式 基类class Student : public Person1.2 继承基类成员访问方式的变化父类成员在子类中的访问权限(除过父类中的私有成员):_什么是赋值转换
文章浏览阅读2.3k次,点赞10次,收藏36次。基于USPS和UCI数据集的近邻法分类一、问题描述 使用近邻算法进行分类问题的研究,并在USPS手写体数据集和UCI数据集上的iris和sonar数据上验证算法的有效性,并分别对近邻法中k近邻算法、最近邻算法和Fisher线性判别进行对比分析。二、数据集说明2.1 USPS手写体 USPS,美国邮政署,是美国联邦政府的独立机构,其中的手_usps数据集是在哪里提出的
文章浏览阅读1.9k次。 平时工作中用到Excel表格的几率特别大,也积累了一些小技巧,今天就给大家分享一下计算年龄的方法。 在Excel表格中利用“系统时间”和“出生年月”来计算“周岁年龄”、“虚岁年龄”和“实际年龄”是非常方便的,特别是人事管理和工资的统计中遇到的可能性比较大,一起来看一下计算年龄的方法吧。 方法一 第一步,如下图所示,先把需要计算年龄的出生日期输入到表格中。 第二步,然后在B2单元格中输..._access计算年龄