IOS 手机浏览屏底部被挡住的CSS解决代码片断
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
/**
* 得到目录下所有文件数组(仅是文件名)
*/
function foreachDir($path){
$fileArray = array();
// 打开文件夹
if( $handle=opendir($path) ){
while ( false !== ($file = readdir($handle)) ) {
// 排除 当前目录 上级目录
if( $file!="." && $file!='..'){
// 打开的是目录
if(is_dir($path.$file)){
foreachDir($path.$file);
// 打开的是文件
}else{
$fileArray[] = $file;
}
}
}
return $fileArray;
}
}
// 得到目录下所有文件数组(仅是文件名)
$fileList = foreachDir('./textbooks');
// 添加新规则
validate.setConfig({
chinese: /.*[\u0391-\uFFE5].*$/
})
// 使用说明
var userRules = {
'old_password':[
{ rule:'required', message:'请输入旧密码' },
{ rule:'NumberOrEnglish', message:'旧密码必须是字线或数字'},
{ rule:'min:6', message:'旧密码不能低于6位长度' },
{ rule:'max:20', message:'旧密码不能超过20位长度'}
],
'new_password':[
{ rule:'required', message:'请输入新密码' },
{ rule:'NumberOrEnglish', message:'新密码必须是字线或数字'},
{ rule:'min:6', message:'新密码不能低于6位长度' },
{ rule:'max:20', message:'新密码不能超过20位长度'}
],
}
// 所有校验不通过的错误
var resultError = validate.test({old_password:'',new_password:''},userRules);
// 全局可被监听数据
watchData : {},
// 对监听的属性进行操作,当值发现变更时
watch: function (Name, method) {
var obj = this.watchData;
Object.defineProperty(obj, Name, {
configurable: true, // 描述属性是否配置,以及可否删除
enumerable: true, // 描述属性是否会出现在for in 或者 Object.keys()的遍历中
set: function (value) {
this['__' + Name] = value;
method(value);
},
get: function () {
// 可以在这里打印一些东西,然后在其他界面调用getApp().GD.name的时候,这里就会执行。
return this['__' + Name]
}
})
},
Array.prototype.indexOf = function(item) {
for (var i = 0; i < this.length; i++) {
if (this[i] == item) return i;
}
return -1;
}
/*
switch盒子
使用参数:宽,高,选中颜色值
使用实例:.toggle-switch(68px,24px,#0092ff);
*/
.toggle-switch (@w:68px,@h:24px,@c:#0092ff){
display: inline-block; position: relative;
width: @w; height: @h; border-radius: 5px;
input[type="checkbox"] {
position: absolute;
width: 100%;
height: 100%;
margin: 0px;
filter: alpha(opacity=0);
opacity: 0;
}
/*默认样式*/
.toggle-switch-content {
width: 100%; height: 100%; display: table; border: 1px #e6e5ea solid; background: #f5f5f7;
border-radius: @h;
}
.switch-true,
.switch-false {
width: @h; height: @h; border-radius: @h;
}
.switch-true {
float: right; background: #FFF; box-shadow: 1px 1px 4px 0 rgba(0,0,0,0.3); display: none;
}
.switch-false {
float: left; background: #FFF; box-shadow: 1px 1px 4px 0 rgba(0,0,0,0.1);
}
/*选中样式*/
input[type="checkbox"]:checked + .toggle-switch-content {
background: @c; border: 1px @c solid;
}
input[type="checkbox"]:checked + .toggle-switch-content .switch-true {
display: block;
}
input[type="checkbox"]:checked + .toggle-switch-content .switch-false {
display: none;
}
}