1.需求及效果
1.1需求
需要获取每个月的7号作为需发布日期,需要自动填充
1.2效果
自动获取每个月的七号
2. 思路
1.功能并不复杂,可以用泛微前端自带的插入代码块的功能来实现。
2.将这需要赋值的三个id拿到,然后进行赋值即可
3. 实现
<script>jQuery(document).ready(function (){var firstDate = jQuery("#field10375");var secondDate = jQuery("#field10376");var thirdDate = jQuery("#field10377");var currentDate = new Date();currentDate.setDate(7);var year = currentDate.getFullYear();var mouth = String(currentDate.getMonth()+1).padStart(2,'0');var day = String(currentDate.getDate()).padStart(2,'0');var formttedDate = year + '-' +mouth + '-' +day;firstDate.val(formttedDate);secondDate.val(formttedDate);thirdDate.val(formttedDate);})</script>