基于angular实现三级联动的生日插件

前端之家收集整理的这篇文章主要介绍了基于angular实现三级联动的生日插件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

写了一个生日联动插件具体的效果是这样的:

具体的数据

我取得数据是今年的数据,如果是想要做三级联动的日期插件,改一下时间就好了

nowyear-lengthYear;i--,j++){ dataPicker.year[j]=i; } for(var i=0;i<=11;i++){ if(i<9){ dataPicker.month[i]='0'+(i+1); }else{ dataPicker.month[i]=String(i+1); } } return dataPicker; } } }])

directive插件的主要内容

生日'+ ''+ ''+ '',link: function (scope,element){ var arr=[]; scope.birthday=scope.birthday=='0000-00-00'?"":scope.birthday var shuju=dataPicker.query() scope.yearAll=shuju.year; scope.MonthAll=shuju.month; if(scope.birthday){ scope.birY=scope.birthday.birthday.split('-')[0]; scope.birM=String(scope.birthday.birthday.split('-')[1]) }else{ scope.birY=""; scope.birM=""; } scope.getDaysInOneMonth=function(year,month){ var month1 = Number(month); month1=parseInt(month1,10) var d= new Date(Number(year),month1,0); return d.getDate(); } scope.getDayArr=function(day){ shuju.day=[]; for(var i=0; i

html

js 传入的数据

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

原文链接:https://www.f2er.com/js/39312.html

猜你在找的JavaScript相关文章