1 基本三大组件
2 数据收集
在 el-form 上面指定 model,在 el-input 组件加 v-model 进行双向数据绑定
3 数据校验
在el-form 上面指定 rules 校验规则,在 el-form-item 组件加 prop,指定要校验的字段
32 表单预校验,当所有的内容都符合规则了,才去调用对应的接口
————————————————
原文链接:>
Dim ThisDay As String = Format(Now, "yyyy-MM-dd") '获得当前日期字符串
Dim ThisDateTime As DateTime = ConvertToDateTime(ThisDay) '当前日期转换成DateTime
Dim ThisWeekDay As Integer = ThisDateTimeDayOfWeek '获得当前日期是星期几
Dim differadd As Integer = 1 - ThisWeekDay '相差的天数(星期1与当前星期几相差的天数)
Dim MyAdd As New TimeSpan(differadd, 0, 0, 0)
Dim MyYear As Integer = Format(Now, "yyyy") '获取当前日期的年份
Dim MyMonth As Integer = Format(Now, "MM") '获取当前日期的月份
Dim MyDay As Integer = Format(Now, "dd") '获取当前日期是几号
Dim MyToday As DateTime = New DateTime(MyYear, MyMonth, MyDay)
Dim Yourday As DateTime = MyTodayAdd(MyAdd)
MsgBox("本周星期一的日期是:" & Yourday)
获取 日期 时间 星期几
var d = new Date();
var datestr = "今天是: " +dgetFullYear() + "-" +(dgetMonth()+1) + "-" + dgetDate() + " " + dgetHours() + ":" + dgetMinutes() + ":" + dgetSeconds() + " 星期"+"日一二三四五六"charAt(dgetDay())
// 判断闰年
DateprototypeisLeapYear = function()
{
return (0==thisgetYear()%4&&((thisgetYear()%100!=0)||(thisgetYear()%400==0)));
}
// 日期格式化
// 格式 YYYY/yyyy/YY/yy 表示年份
// MM/M 月份
// W/w 星期
// dd/DD/d/D 日期
// hh/HH/h/H 时间
// mm/m 分钟
// ss/SS/s/S 秒
//---------------------------------------------------
DateprototypeFormat = function(formatStr)
{
var str = formatStr;
var Week = ['日','一','二','三','四','五','六'];
str=strreplace(/yyyy|YYYY/,thisgetFullYear());
str=strreplace(/yy|YY/,(thisgetYear() % 100)>9 (thisgetYear() % 100)toString():'0' + (thisgetYear() % 100));
代码如下:
// 获取指定日期所在星期的开始时间与结束时间
function getWeekRange($date){
$ret=array();
$timestamp=strtotime($date);
$w=strftime('%u',$timestamp);
$ret['sdate']=date('Y-m-d 00:00:00',$timestamp-($w-1)86400);
$ret['edate']=date('Y-m-d 23:59:59',$timestamp+(7-$w)86400);
return $ret;
}
// 获取指定日期所在月的开始日期与结束日期
function getMonthRange($date){
$ret=array();
$timestamp=strtotime($date);
$mdays=date('t',$timestamp);
$ret['sdate']=date('Y-m-1 00:00:00',$timestamp);
$ret['edate']=date('Y-m-'$mdays' 23:59:59',$timestamp);
return $ret;
}
// 以上两个函数的应用
function getFilter($n){
$ret=array();
switch($n){
case 1:// 昨天
$ret['sdate']=date('Y-m-d 00:00:00',strtotime('-1 day'));
$ret['edate']=date('Y-m-d 23:59:59',strtotime('-1 day'));
break;
case 2://本星期
$ret=getWeekRange(date('Y-m-d'));
break;
case 3://上一个星期
$strDate=date('Y-m-d',strtotime('-1 week'));
$ret=getWeekRange($strDate);
break;
case 4: //上上星期
$strDate=date('Y-m-d',strtotime('-2 week'));
$ret=getWeekRange($strDate);
break;
case 5: //本月
$ret=getMonthRange(date('Y-m-d'));
break;
case 6://上月
$strDate=date('Y-m-d',strtotime('-1 month'));
$ret=getMonthRange($strDate);
break;
}
return $ret;
}
用来格式化内容(字典翻译)
表格某一字段长这样:
后台返回的字段是这样的:
status: off 或者 status: on
后台提供的字典:
后台返回英文,可是要求中文展示,如果有下拉列表查询框,选择以后又要求传给后台的是英文怎么办?
我们可以在mounted的时候获取字典,然后组装一下:
statusOptions可以用来做用于筛选的下拉列表:
在表格的“状态“”这一栏使用formatter属性:
这样就可以把字段翻译成自己需要的语言,而不影响传递给后台的值。做国际化的时候很方便,因为后端返回的字典可能变成status: {all: "all", off: "offline", on: "online"}或者别的语言,这样做不管后端怎么变,前端完全不用修改。
以上就是关于Element-ui 表单的基础使用全部的内容,包括:Element-ui 表单的基础使用、怎样用js根据当前星期几获取日期的、vb.net中如何获取当前日期所在星期的星期一的具体年月日等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)