
如何利用Lunar组件获取指定月份的所有老黄历宜忌数据,下面web建站小编给大家简单介绍一下具体获取方法!下面代码中this.year指的是获取的年份,this.month指的是获取的月份!
//获取指定月份的天数
getDaysInMonth() {
const date = new Date(this.year, this.month, 0);
this.daysInMonth = date.getDate();
},
//获取指定月份的每日宜
getDayYiText(){
let cData = []
for(let i=0; i<this.daysInMonth; i++){
const today = this.year + '-' + this.month + '-' + (i+1)
const d = Lunar.fromDate(new Date(today));
let l = d.getDayYi();
let arr = []
for (let i=0, j=l.length; i<j; i++){
arr.push(l[i])
}
console.log('获取指定月份所有每日宜', arr)
}
},
//获取指定月份的每日忌
getDayJiText(){
let cData = []
for(let i=0; i<this.daysInMonth; i++){
const today = this.year + '-' + this.month + '-' + (i+1)
const d = Lunar.fromDate(new Date(today));
let l = d.getDayJi();
let arr = []
for (let i=0, j=l.length; i<j; i++){
arr.push(l[i])
}
console.log('获取指定月份所有每日忌', arr)
}
}
javascript获取当前时间有哪些节假日(常见国内国际节日和其他纪念日)
上面是“Lunar组件获取指定月份的所有老黄历每日宜忌”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_16011.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

af-table-column有什么用?(用法介绍)
熊猫办公:AI办公服务平台,提供PPT模板、Excel模板、Word模板等资源
PapersGPT