如何解决访问 activeIndex
我对 React、JS 和编码非常陌生,在阅读了几次文档后,我仍然无法弄清楚这一点。我正在使用带有反应的 swiper.js 包。初始设置工作正常,但现在我试图访问 activeIndex 并且无法弄清楚如何获取它。如果有人能帮我访问,那就太好了,谢谢!
const cron = require('node-cron');
const mailer = require('nodemailer');
//T0 Get the Current Year,Month And Day
var dateYear = new Date().getFullYear();
var dateMonth = new Date().getMonth(); // start counting from 0
var dateDay = new Date().getDate();// start counting from 1
/* The Schema Which The Database Follow
{
'id' : number,'name' : string,'dob' : string (day - month),'email' : string
},* You can Use Any type of schema (This is the method I preferred)
*/
/// database goes here
var users = [
{
'id' : 000,'name' : 'user1','dob' : '14-6-1994','email' : 'user1@exapmle.com'
},{
'id' : 001,'name' : 'user2','dob' : '15-6-2003','email' : 'user2@exapmle.com'
},{
'id' : 002,'name' : 'user3','dob' : '17-4-2004','email' : 'user3@exapmle.com'
},{
'id' : 003,'name' : 'user4','dob' : '6-0-1999','email' : 'user4@exapmle.com'
}
]
//// credentials for your Mail
var transporter = mailer.createTransport({
host: 'YOUR STMP SERVER',port: 465,secure: true,auth: {
user: 'YOUR EMAIL',pass: 'YOUR PASSWORD'
}
});
//Cron Job to run around 7am Server Time
cron.schedule('* * 07 * * *',() => {
///The Main Function
const sendWishes =
// looping through the users
users.forEach(element => {
// Spliting the Date of Birth (DOB)
// to get the Month And Day
let d = element.dob.split('-')
let dM = +d[1] // For the month
let dD = +d[0] // for the day
let age = dateYear - +d[2]
console.log( typeof dM) //return number
// Sending the Mail
if(dateDay == dD && dateMonth == dM ){
const mailOptions = {
from: 'YOUR EMAIL',to: element.email,subject: `Happy Birthday `,html: `Wishing You a <b>Happy birthday ${element.name}</b> On Your ${age},Enjoy your day \n <small>this is auto generated</small>`
};
return transporter.sendMail(mailOptions,(error,data) => {
if (error) {
console.log(error)
return
}
});
}
});
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。