<el-form-item label="有效期限" > <el-col :span="6"> <el-form-item> <el-date-picker
type="date" placeholder="选择日期" value-format="yyyy-MM-dd 00:00:00"
v-model="effectiveStartTime" :picker-options="pickerOptionsStart"
></el-date-picker> </el-form-item> </el-col> <el-col class="line"
:span="2">-</el-col> <el-col :span="6"> <el-form-item> <el-date-picker
placeholder="选择日期" value-format="yyyy-MM-dd 00:00:00"
v-model="effectiveEntTime" :picker-options="pickerOptionsEnd"
></el-date-picker> </el-form-item> </el-col> </el-form-item>
以上template视图层
return { effectiveEntTime: "", effectiveEntTime: "", pickerOptionsStart: {
//开始有效期 disabledDate: (time) => { if (this.effectiveEntTime) { return
time.getTime() > new Date(this.effectiveEntTime).getTime(); } }, },
pickerOptionsEnd: { //结束有效期 disabledDate: (time) => { if
(this.effectiveStartTime) { return ( time.getTime() - 3600 * 1000 * 24 < new
Date(this.effectiveStartTime).getTime() - 86400000 || Date.now() - 3600 * 1000
* 24 > time.getTime() ); } }, }, };
script 逻辑层

效果

 

 

技术
今日推荐
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:766591547
关注微信