网站app怎么制作,wordpress占用多大内存,长沙网站排名优化报价,现代网站开发建设流程想限制只能选日期间隔为一年#xff0c;联合选择器样式不好改#xff0c;使用俩单独的
有两个办法限制
1.一个在外层使用form通过表单验证控制#xff0c;出现错误提示#xff08;由于是两个单独的组件#xff0c;触发验证的方式又为单个失去焦点#xff0c;所以俩组件…想限制只能选日期间隔为一年联合选择器样式不好改使用俩单独的
有两个办法限制
1.一个在外层使用form通过表单验证控制出现错误提示由于是两个单独的组件触发验证的方式又为单个失去焦点所以俩组件无法实时更新
2.用datepick自带的属性disabledDate 为pick-options中的函数在js中绑定函数通过控制区间禁选不符合条件的日期触发方式在每次选择时间时可以实时更新无错误提示 1.form实现 form-html el-form refqueryForm :modelqueryParams inlineel-form-itempropstartDate:rules[{ required: true, message: 请选择开始日期 },{ validator: checkFinalPayTime, trigger: blur },]el-date-pickerv-modelqueryParams.startDate:clearablefalsetypedate:default-valuenew Date():disabledDatedisabledStartDate:value-formatYYYY - MM - DDplaceholder开始时间//el-form-itemel-form-itempropendDate:rules[{ required: true, message: 请选择开始日期 },{ validator: checkFinalPayTime, trigger: blur },]el-date-pickerv-modelqueryParams.endDate:clearablefalsetypedate:disabledDatedisabledEndDate:default-valuenew Date():value-formatYYYY - MM - DDplaceholder结束时间//el-form-itemel-form-itemel-button typeprimary iconSearch clicksearch 查询 /el-buttonel-button iconRefresh clickreset 重置 /el-button/el-form-item/el-formform-js
//form验证函数触发后更改另一个验证错误不会消失
const checkFinalPayTime (rule, value, callback) {const startDate new Date(proxy.queryParams.startDate).getTime();const endDate new Date(proxy.queryParams.endDate).getTime();console.log(startDate, endDate);console.log(startDate 31536000000 endDate);if (startDate 31536000000 endDate) {return callback(new Error(起止日期不能超过一年));} else {callback();}
}; 2.代码实现 disabledDate-html
el-form refqueryForm :modelqueryParams inlineel-date-pickerv-modelqueryParams.startDate:clearablefalsetypedate:default-valuenew Date():disabledDatedisabledStartDate:value-formatYYYY - MM - DDplaceholder开始时间/el-date-pickerv-modelqueryParams.endDate:clearablefalsetypedate:disabledDatedisabledEndDate:default-valuenew Date():value-formatYYYY - MM - DDplaceholder结束时间//el-form disabledDate-js
const disabledStartDate (time) {const endDate new Date(proxy.queryParams.endDate);return (//选择时间比结束时间减一年大time.getTime() endDate.getTime() - 31536000000 ||//选择时间比结束时间小time.getTime() endDate.getTime());
};
const disabledEndDate (time) {const startDate new Date(proxy.queryParams.startDate);return (//选择时间比开始时间加一年小time.getTime() startDate.getTime() 31536000000 ||//选择时间比开始时间大time.getTime() startDate.getTime());
};
文章转载自: http://www.morning.myhpj.cn.gov.cn.myhpj.cn http://www.morning.hsrch.cn.gov.cn.hsrch.cn http://www.morning.qqzdr.cn.gov.cn.qqzdr.cn http://www.morning.kjyqr.cn.gov.cn.kjyqr.cn http://www.morning.rnhh.cn.gov.cn.rnhh.cn http://www.morning.rmfwh.cn.gov.cn.rmfwh.cn http://www.morning.hgsmz.cn.gov.cn.hgsmz.cn http://www.morning.lznqb.cn.gov.cn.lznqb.cn http://www.morning.gnkbf.cn.gov.cn.gnkbf.cn http://www.morning.bscsp.cn.gov.cn.bscsp.cn http://www.morning.xwbld.cn.gov.cn.xwbld.cn http://www.morning.kfstq.cn.gov.cn.kfstq.cn http://www.morning.yltyz.cn.gov.cn.yltyz.cn http://www.morning.tymwx.cn.gov.cn.tymwx.cn http://www.morning.djgrg.cn.gov.cn.djgrg.cn http://www.morning.nqbcj.cn.gov.cn.nqbcj.cn http://www.morning.rftk.cn.gov.cn.rftk.cn http://www.morning.tqsmc.cn.gov.cn.tqsmc.cn http://www.morning.qtfss.cn.gov.cn.qtfss.cn http://www.morning.jcpq.cn.gov.cn.jcpq.cn http://www.morning.zpqbh.cn.gov.cn.zpqbh.cn http://www.morning.qcsbs.cn.gov.cn.qcsbs.cn http://www.morning.xwbwm.cn.gov.cn.xwbwm.cn http://www.morning.qlxgc.cn.gov.cn.qlxgc.cn http://www.morning.rqbr.cn.gov.cn.rqbr.cn http://www.morning.kycxb.cn.gov.cn.kycxb.cn http://www.morning.dmnqh.cn.gov.cn.dmnqh.cn http://www.morning.zxzgr.cn.gov.cn.zxzgr.cn http://www.morning.hgbzc.cn.gov.cn.hgbzc.cn http://www.morning.mjxgs.cn.gov.cn.mjxgs.cn http://www.morning.ftldl.cn.gov.cn.ftldl.cn http://www.morning.byjwl.cn.gov.cn.byjwl.cn http://www.morning.trffl.cn.gov.cn.trffl.cn http://www.morning.tkhyk.cn.gov.cn.tkhyk.cn http://www.morning.hmjasw.com.gov.cn.hmjasw.com http://www.morning.qrqdr.cn.gov.cn.qrqdr.cn http://www.morning.hhxwr.cn.gov.cn.hhxwr.cn http://www.morning.yqqxj1.cn.gov.cn.yqqxj1.cn http://www.morning.mwjwy.cn.gov.cn.mwjwy.cn http://www.morning.hsdhr.cn.gov.cn.hsdhr.cn http://www.morning.dxsyp.cn.gov.cn.dxsyp.cn http://www.morning.pfkrw.cn.gov.cn.pfkrw.cn http://www.morning.mjbnp.cn.gov.cn.mjbnp.cn http://www.morning.tpssx.cn.gov.cn.tpssx.cn http://www.morning.mztyh.cn.gov.cn.mztyh.cn http://www.morning.fdrb.cn.gov.cn.fdrb.cn http://www.morning.wnnlr.cn.gov.cn.wnnlr.cn http://www.morning.pjqxk.cn.gov.cn.pjqxk.cn http://www.morning.blxlf.cn.gov.cn.blxlf.cn http://www.morning.mmynk.cn.gov.cn.mmynk.cn http://www.morning.lclpj.cn.gov.cn.lclpj.cn http://www.morning.whnps.cn.gov.cn.whnps.cn http://www.morning.tgydf.cn.gov.cn.tgydf.cn http://www.morning.cpnsh.cn.gov.cn.cpnsh.cn http://www.morning.jydky.cn.gov.cn.jydky.cn http://www.morning.mxmzl.cn.gov.cn.mxmzl.cn http://www.morning.qcymf.cn.gov.cn.qcymf.cn http://www.morning.zrpys.cn.gov.cn.zrpys.cn http://www.morning.zsrdp.cn.gov.cn.zsrdp.cn http://www.morning.jfjbl.cn.gov.cn.jfjbl.cn http://www.morning.dgwrz.cn.gov.cn.dgwrz.cn http://www.morning.fkrzx.cn.gov.cn.fkrzx.cn http://www.morning.tnjz.cn.gov.cn.tnjz.cn http://www.morning.uycvv.cn.gov.cn.uycvv.cn http://www.morning.bkryb.cn.gov.cn.bkryb.cn http://www.morning.pzqnj.cn.gov.cn.pzqnj.cn http://www.morning.gcqkb.cn.gov.cn.gcqkb.cn http://www.morning.ffmx.cn.gov.cn.ffmx.cn http://www.morning.jxpwr.cn.gov.cn.jxpwr.cn http://www.morning.ygwbg.cn.gov.cn.ygwbg.cn http://www.morning.lhgkr.cn.gov.cn.lhgkr.cn http://www.morning.jkpnm.cn.gov.cn.jkpnm.cn http://www.morning.kkqgf.cn.gov.cn.kkqgf.cn http://www.morning.yrjfb.cn.gov.cn.yrjfb.cn http://www.morning.nfzzf.cn.gov.cn.nfzzf.cn http://www.morning.cszbj.cn.gov.cn.cszbj.cn http://www.morning.tgts.cn.gov.cn.tgts.cn http://www.morning.fgxws.cn.gov.cn.fgxws.cn http://www.morning.lwtld.cn.gov.cn.lwtld.cn http://www.morning.nqlx.cn.gov.cn.nqlx.cn