参考链接:https://blog.csdn.net/weixin_44483624/article/details/115455486
插件:npm install --save chinese-lunar-calendar
vue使用
<script>
import { getLunar } from 'chinese-lunar-calendar'
export default {
data() {
return {
getLunarDay: '',
year: new Date().getFullYear(),
month: new Date().getMonth() + 1,
date: new Date().getDate()
}
},
mounted() {
// 获取农历
this.getLunarDay = getLunar(this.year, this.month, this.date)
console.log(this.getLunarDay)
}
}
</script>